summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/app/inputhdl.cxx41
-rw-r--r--sc/source/ui/app/scmod.cxx22
-rw-r--r--sc/source/ui/docshell/docsh8.cxx2
-rw-r--r--sc/source/ui/docshell/tablink.cxx5
-rw-r--r--sc/source/ui/inc/inputhdl.hxx4
-rw-r--r--sc/source/ui/inc/optdlg.hrc1
-rw-r--r--sc/source/ui/inc/output.hxx23
-rw-r--r--sc/source/ui/inc/teamdlg.hxx53
-rw-r--r--sc/source/ui/inc/tpcalc.hxx1
-rw-r--r--sc/source/ui/miscdlgs/autofmt.cxx4
-rw-r--r--sc/source/ui/miscdlgs/makefile.mk2
-rw-r--r--sc/source/ui/miscdlgs/teamdlg.cxx116
-rw-r--r--sc/source/ui/optdlg/tpcalc.cxx59
-rw-r--r--sc/source/ui/src/globstr.src4
-rw-r--r--sc/source/ui/src/miscdlgs.src17
-rw-r--r--sc/source/ui/src/optdlg.src38
-rw-r--r--sc/source/ui/unoobj/defltuno.cxx11
-rw-r--r--sc/source/ui/unoobj/docuno.cxx9
-rw-r--r--sc/source/ui/unoobj/filtuno.cxx4
-rw-r--r--sc/source/ui/unoobj/nameuno.cxx2
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx27
-rwxr-xr-xsc/source/ui/view/dbfunc3.cxx171
-rw-r--r--sc/source/ui/view/drawview.cxx8
-rw-r--r--sc/source/ui/view/output2.cxx481
24 files changed, 606 insertions, 499 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 40b65ce401ad..28f178565da0 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -429,7 +429,9 @@ ScInputHandler::ScInputHandler()
pColumnData( NULL ),
pFormulaData( NULL ),
pFormulaDataPara( NULL ),
+ pTipVisibleParent( NULL ),
nTipVisible( 0 ),
+ pTipVisibleSecParent( NULL ),
nTipVisibleSec( 0 ),
nAutoPos( SCPOS_INVALID ),
bUseTab( FALSE ),
@@ -691,12 +693,29 @@ void ScInputHandler::GetFormulaData()
}
}
+IMPL_LINK( ScInputHandler, ShowHideTipVisibleParentListener, VclWindowEvent*, pEvent )
+{
+ if( pEvent->GetId() == VCLEVENT_OBJECT_DYING || pEvent->GetId() == VCLEVENT_WINDOW_HIDE )
+ HideTip();
+ return 0;
+}
+
+IMPL_LINK( ScInputHandler, ShowHideTipVisibleSecParentListener, VclWindowEvent*, pEvent )
+{
+ if( pEvent->GetId() == VCLEVENT_OBJECT_DYING || pEvent->GetId() == VCLEVENT_WINDOW_HIDE )
+ HideTipBelow();
+ return 0;
+}
+
void ScInputHandler::HideTip()
{
if ( nTipVisible )
{
+ if (pTipVisibleParent)
+ pTipVisibleParent->RemoveEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleParentListener ) );
Help::HideTip( nTipVisible );
nTipVisible = 0;
+ pTipVisibleParent = NULL;
}
aManualTip.Erase();
}
@@ -704,8 +723,11 @@ void ScInputHandler::HideTipBelow()
{
if ( nTipVisibleSec )
{
+ if (pTipVisibleSecParent)
+ pTipVisibleSecParent->RemoveEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleSecParentListener ) );
Help::HideTip( nTipVisibleSec );
nTipVisibleSec = 0;
+ pTipVisibleSecParent = NULL;
}
aManualTip.Erase();
}
@@ -897,15 +919,16 @@ void ScInputHandler::ShowTip( const String& rText )
if (pActiveView)
{
Point aPos;
- Window* pWin = pActiveView->GetWindow();
+ pTipVisibleParent = pActiveView->GetWindow();
Cursor* pCur = pActiveView->GetCursor();
if (pCur)
- aPos = pWin->LogicToPixel( pCur->GetPos() );
- aPos = pWin->OutputToScreenPixel( aPos );
+ aPos = pTipVisibleParent->LogicToPixel( pCur->GetPos() );
+ aPos = pTipVisibleParent->OutputToScreenPixel( aPos );
Rectangle aRect( aPos, aPos );
USHORT nAlign = QUICKHELP_LEFT|QUICKHELP_BOTTOM;
- nTipVisible = Help::ShowTip(pWin, aRect, rText, nAlign);
+ nTipVisible = Help::ShowTip(pTipVisibleParent, aRect, rText, nAlign);
+ pTipVisibleParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleParentListener ) );
}
}
@@ -917,18 +940,19 @@ void ScInputHandler::ShowTipBelow( const String& rText )
if ( pActiveView )
{
Point aPos;
- Window* pWin = pActiveView->GetWindow();
+ pTipVisibleSecParent = pActiveView->GetWindow();
Cursor* pCur = pActiveView->GetCursor();
if ( pCur )
{
Point aLogicPos = pCur->GetPos();
aLogicPos.Y() += pCur->GetHeight();
- aPos = pWin->LogicToPixel( aLogicPos );
+ aPos = pTipVisibleSecParent->LogicToPixel( aLogicPos );
}
- aPos = pWin->OutputToScreenPixel( aPos );
+ aPos = pTipVisibleSecParent->OutputToScreenPixel( aPos );
Rectangle aRect( aPos, aPos );
USHORT nAlign = QUICKHELP_LEFT | QUICKHELP_TOP;
- nTipVisibleSec = Help::ShowTip(pWin, aRect, rText, nAlign);
+ nTipVisibleSec = Help::ShowTip(pTipVisibleSecParent, aRect, rText, nAlign);
+ pTipVisibleSecParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleSecParentListener ) );
}
}
@@ -2690,6 +2714,7 @@ void ScInputHandler::EnterHandler( BYTE nBlockMode )
delete pObject;
HideTip();
+ HideTipBelow();
nFormSelStart = nFormSelEnd = 0;
aFormText.Erase();
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index dc5d1010dfc8..94e18def8a11 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -98,7 +98,6 @@
#include "msgpool.hxx"
#include "scresid.hxx"
#include "anyrefdg.hxx"
-#include "teamdlg.hxx"
#include "dwfunctr.hxx"
#include "formdata.hxx"
//CHINA001 #include "tpview.hxx"
@@ -142,7 +141,6 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
pSelTransfer( NULL ),
pMessagePool( NULL ),
pRefInputHandler( NULL ),
- pTeamDlg( NULL ),
pViewCfg( NULL ),
pDocCfg( NULL ),
pAppCfg( NULL ),
@@ -1507,11 +1505,6 @@ void ScModule::ViewShellGone( ScTabViewShell* pViewSh )
ScInputHandler* pHdl = GetInputHdl();
if (pHdl)
pHdl->ViewShellGone( pViewSh );
-
- // Team dialog is opened with the window from a view as parent
- // -> close it if any view is closed
- if (pTeamDlg)
- pTeamDlg->Close(); // resets variable pTeamDlg
}
void ScModule::SetRefInputHdl( ScInputHandler* pNew )
@@ -1635,21 +1628,6 @@ void ScModule::SetRefDialog( USHORT nId, BOOL bVis, SfxViewFrame* pViewFrm )
}
}
-void ScModule::OpenTeamDlg()
-{
- if ( !pTeamDlg )
- {
- // team dialog needs an existing parent window
- // -> use window from active view (dialog is closed in ViewShellGone)
-
- ScTabViewShell* pShell = ScTabViewShell::GetActiveViewShell();
- if (pShell)
- pTeamDlg = new ScTeamDlg( pShell->GetActiveWin() );
- }
- else
- pTeamDlg->Center();
-}
-
SfxChildWindow* lcl_GetChildWinFromAnyView( USHORT nId )
{
// first try the current view
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index b761dd75d9df..cb9d625da70c 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -597,7 +597,7 @@ void lcl_GetColumnTypes( ScDocShell& rDocShell,
else if ( nDbType == sdbc::DataType::DECIMAL )
{ // maximale Feldbreite und Nachkommastellen bestimmen
xub_StrLen nLen;
- USHORT nPrec;
+ sal_uInt16 nPrec;
nLen = pDoc->GetMaxNumberStringLen( nPrec, nTab, nCol,
nFirstDataRow, nLastRow );
// dBaseIII Limit Nachkommastellen: 15
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 4d18f9f18c37..697b39052b9f 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -485,6 +485,11 @@ BOOL ScDocumentLoader::GetFilterName( const String& rFileName,
pDocSh = SfxObjectShell::GetNext( *pDocSh, &aScType );
}
+ INetURLObject aUrl( rFileName );
+ INetProtocol eProt = aUrl.GetProtocol();
+ if ( eProt == INET_PROT_NOT_VALID ) // invalid URL?
+ return FALSE; // abort without creating a medium
+
// Filter-Detection
const SfxFilter* pSfxFilter = NULL;
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index bcc5ba0dd396..61974cf7464d 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -68,7 +68,9 @@ private:
TypedScStrCollection* pColumnData;
TypedScStrCollection* pFormulaData;
TypedScStrCollection* pFormulaDataPara;
+ Window* pTipVisibleParent;
ULONG nTipVisible;
+ Window* pTipVisibleSecParent;
ULONG nTipVisibleSec;
String aManualTip;
String aAutoSearch;
@@ -149,6 +151,8 @@ private:
BOOL CursorAtClosingPar();
void SkipClosingPar();
DECL_LINK( ModifyHdl, void* );
+ DECL_LINK( ShowHideTipVisibleParentListener, VclWindowEvent* );
+ DECL_LINK( ShowHideTipVisibleSecParentListener, VclWindowEvent* );
#endif
public:
diff --git a/sc/source/ui/inc/optdlg.hrc b/sc/source/ui/inc/optdlg.hrc
index 00cfdb2c6d5a..27b8976e3541 100644
--- a/sc/source/ui/inc/optdlg.hrc
+++ b/sc/source/ui/inc/optdlg.hrc
@@ -70,6 +70,7 @@
#define BTN_MATCH 18
#define BTN_LOOKUP 19
#define BTN_REGEX 20
+#define BTN_GENERAL_PREC 21
// TP_VIEW:
#define BTN_VSCROLL 1
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index 8d512898afd3..42844513af92 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -73,6 +73,15 @@ class ScOutputData
{
friend class ScDrawStringsVars;
private:
+ struct OutputAreaParam
+ {
+ Rectangle maAlignRect;
+ Rectangle maClipRect;
+ long mnColWidth;
+ bool mbLeftClip;
+ bool mbRightClip;
+ };
+
OutputDevice* pDev; // Device
OutputDevice* pRefDevice; // printer if used for preview
OutputDevice* pFmtDevice; // reference for text formatting
@@ -152,19 +161,19 @@ private:
void GetVisibleCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell );
BOOL IsAvailable( SCCOL nX, SCROW nY );
+
void GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY,
- SCCOL nCellX, SCROW nCellY, long nNeeded,
- const ScPatternAttr& rPattern,
- USHORT nHorJustify, BOOL bCellIsValue,
- BOOL bBreak, BOOL bOverwrite,
- Rectangle& rAlignRect, Rectangle& rClipRect,
- BOOL& rLeftClip, BOOL& rRightClip );
+ SCCOL nCellX, SCROW nCellY, long nNeeded,
+ const ScPatternAttr& rPattern,
+ USHORT nHorJustify, bool bCellIsValue,
+ bool bBreak, bool bOverwrite,
+ OutputAreaParam& rParam );
void ShrinkEditEngine( EditEngine& rEngine, const Rectangle& rAlignRect,
long nLeftM, long nTopM, long nRightM, long nBottomM,
BOOL bWidth, USHORT nOrient, long nAttrRotate, BOOL bPixelToLogic,
long& rEngineWidth, long& rEngineHeight, long& rNeededPixel,
- BOOL& rLeftClip, BOOL& rRightClip );
+ bool& rLeftClip, bool& rRightClip );
void SetSyntaxColor( Font* pFont, ScBaseCell* pCell );
void SetEditSyntaxColor( EditEngine& rEngine, ScBaseCell* pCell );
diff --git a/sc/source/ui/inc/teamdlg.hxx b/sc/source/ui/inc/teamdlg.hxx
deleted file mode 100644
index 9f44f06c4b12..000000000000
--- a/sc/source/ui/inc/teamdlg.hxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_TEAMDLG_HXX
-#define SC_TEAMDLG_HXX
-
-
-#include <vcl/floatwin.hxx>
-#include <vcl/fixed.hxx>
-
-
-//========================================================================
-
-class ScTeamDlg : public FloatingWindow
-{
-public:
- ScTeamDlg( Window* pParent );
- ~ScTeamDlg();
-
- virtual BOOL Close();
- void Center();
-
-private:
- FixedBitmap aBmpTeam;
-};
-
-
-#endif
-
diff --git a/sc/source/ui/inc/tpcalc.hxx b/sc/source/ui/inc/tpcalc.hxx
index ea9e53a23ee4..31f2c9458c83 100644
--- a/sc/source/ui/inc/tpcalc.hxx
+++ b/sc/source/ui/inc/tpcalc.hxx
@@ -76,6 +76,7 @@ private:
CheckBox aBtnMatch;
CheckBox aBtnRegex;
CheckBox aBtnLookUp;
+ CheckBox aBtnGeneralPrec;
FixedText aFtPrec;
NumericField aEdPrec;
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 940856775c07..6ce65ab914be 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -68,8 +68,6 @@
#define FRAME_OFFSET 4
-BOOL bIsOlk = FALSE;
-
//CHINA001 //========================================================================
//CHINA001 // AutoFormat-Dialog:
@@ -508,8 +506,6 @@ ScAutoFmtPreview::ScAutoFmtPreview( Window* pParent, const ResId& rRes, ScDocume
pNumFmt ( new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), ScGlobal::eLnge ) )
{
Init();
- if( bIsOlk )
- ((String&)aStrMar).AssignAscii(RTL_CONSTASCII_STRINGPARAM( "Olk" ));
}
//------------------------------------------------------------------------
diff --git a/sc/source/ui/miscdlgs/makefile.mk b/sc/source/ui/miscdlgs/makefile.mk
index 9f5bb1dbc498..ac210bcfaa83 100644
--- a/sc/source/ui/miscdlgs/makefile.mk
+++ b/sc/source/ui/miscdlgs/makefile.mk
@@ -60,7 +60,6 @@ SLOFILES = \
$(SLO)$/crdlg.obj \
$(SLO)$/namecrea.obj \
$(SLO)$/namepast.obj \
- $(SLO)$/teamdlg.obj \
$(SLO)$/textdlgs.obj \
$(SLO)$/anyrefdg.obj \
$(SLO)$/crnrdlg.obj \
@@ -109,7 +108,6 @@ LIB1OBJFILES = \
$(SLO)$/solveroptions.obj \
$(SLO)$/solverutil.obj \
$(SLO)$/tabopdlg.obj \
- $(SLO)$/teamdlg.obj \
$(SLO)$/anyrefdg.obj \
$(SLO)$/crnrdlg.obj \
$(SLO)$/acredlin.obj \
diff --git a/sc/source/ui/miscdlgs/teamdlg.cxx b/sc/source/ui/miscdlgs/teamdlg.cxx
deleted file mode 100644
index a9f1bf2a17cf..000000000000
--- a/sc/source/ui/miscdlgs/teamdlg.cxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sc.hxx"
-
-
-
-//------------------------------------------------------------------
-
-#include <tools/shl.hxx>
-
-#include "teamdlg.hxx"
-#include "scmod.hxx"
-#include "scresid.hxx"
-#include "sc.hrc"
-
-
-//------------------------------------------------------------------
-
-void ShowTheTeam()
-{
- SC_MOD()->OpenTeamDlg();
-}
-
-//========================================================================
-// ScTeamDlg
-//========================================================================
-
-ScTeamDlg::ScTeamDlg( Window* pParent )
- : FloatingWindow( pParent, ScResId( RID_SCDLG_TEAM ) ),
- aBmpTeam ( this, ScResId( 1 ) )
-{
- FreeResource();
- SC_MOD()->SetTeamDlg( this );
-
- Bitmap aBmp( ScResId( RID_SCTEAMDLGBMP1 ) );
-
- Size aSize = aBmp.GetSizePixel();
- USHORT nOff = (USHORT)aBmpTeam.GetPosPixel().X();
-
- aBmpTeam.SetSizePixel( aSize );
- aBmpTeam.SetBitmap( aBmp );
- aSize.Width() += (2*nOff);
- aSize.Height() += (2*nOff);
- SetOutputSizePixel( aSize );
- Center();
- Point aPos = GetPosPixel();
- if (aPos.Y() < 0)
- {
- // #87164# title bar must be visible
- aPos.Y() = 0;
- SetPosPixel(aPos);
- }
- Show();
-}
-
-//------------------------------------------------------------------------
-
-__EXPORT ScTeamDlg::~ScTeamDlg()
-{
-}
-
-//------------------------------------------------------------------------
-
-BOOL __EXPORT ScTeamDlg::Close()
-{
- BOOL bReturn = FloatingWindow::Close();
-
- SC_MOD()->SetTeamDlg( NULL );
- delete this;
-
- return bReturn;
-}
-
-//------------------------------------------------------------------------
-
-void ScTeamDlg::Center()
-{
- if ( IsRollUp() ) RollDown();
-
- Size aSizeDesktop = GetParent()->GetSizePixel();
- Size aSize = GetSizePixel();
- Point aNewPos;
-
- aNewPos.X() = (aSizeDesktop.Width() - aSize.Width()) / 2;
- aNewPos.Y() = (aSizeDesktop.Height() - aSize.Height()) / 2;
- SetPosPixel( aNewPos );
-}
-
-
-
diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx
index c6423ea73b23..5b5920e904fc 100644
--- a/sc/source/ui/optdlg/tpcalc.cxx
+++ b/sc/source/ui/optdlg/tpcalc.cxx
@@ -88,6 +88,7 @@ ScTpCalcOptions::ScTpCalcOptions( Window* pParent,
aBtnMatch ( this, ScResId( BTN_MATCH ) ),
aBtnRegex ( this, ScResId( BTN_REGEX ) ),
aBtnLookUp ( this, ScResId( BTN_LOOKUP ) ),
+ aBtnGeneralPrec ( this, ScResId( BTN_GENERAL_PREC ) ),
aFtPrec ( this, ScResId( FT_PREC ) ),
aEdPrec ( this, ScResId( ED_PREC ) ),
pOldOptions ( new ScDocOptions(
@@ -116,6 +117,7 @@ __EXPORT ScTpCalcOptions::~ScTpCalcOptions()
void ScTpCalcOptions::Init()
{
aBtnIterate .SetClickHdl( LINK( this, ScTpCalcOptions, CheckClickHdl ) );
+ aBtnGeneralPrec.SetClickHdl( LINK(this, ScTpCalcOptions, CheckClickHdl) );
aBtnDateStd .SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
aBtnDateSc10.SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
aBtnDate1904.SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
@@ -150,7 +152,6 @@ void __EXPORT ScTpCalcOptions::Reset( const SfxItemSet& /* rCoreAttrs */ )
aBtnLookUp .Check( pLocalOptions->IsLookUpColRowNames() );
aBtnIterate.Check( pLocalOptions->IsIter() );
aEdSteps .SetValue( pLocalOptions->GetIterCount() );
- aEdPrec .SetValue( pLocalOptions->GetStdPrecision() );
aEdEps .SetValue( pLocalOptions->GetIterEps(), 6 );
pLocalOptions->GetDate( d, m, y );
@@ -168,6 +169,21 @@ void __EXPORT ScTpCalcOptions::Reset( const SfxItemSet& /* rCoreAttrs */ )
break;
}
+ sal_uInt16 nPrec = pLocalOptions->GetStdPrecision();
+ if (nPrec == SvNumberFormatter::UNLIMITED_PRECISION)
+ {
+ aFtPrec.Disable();
+ aEdPrec.Disable();
+ aBtnGeneralPrec.Check(false);
+ }
+ else
+ {
+ aBtnGeneralPrec.Check();
+ aFtPrec.Enable();
+ aEdPrec.Enable();
+ aEdPrec.SetValue(nPrec);
+ }
+
CheckClickHdl( &aBtnIterate );
}
@@ -178,13 +194,18 @@ BOOL __EXPORT ScTpCalcOptions::FillItemSet( SfxItemSet& rCoreAttrs )
{
// alle weiteren Optionen werden in den Handlern aktualisiert
pLocalOptions->SetIterCount( (USHORT)aEdSteps.GetValue() );
- pLocalOptions->SetStdPrecision( (USHORT)aEdPrec.GetValue() );
pLocalOptions->SetIgnoreCase( !aBtnCase.IsChecked() );
pLocalOptions->SetCalcAsShown( aBtnCalc.IsChecked() );
pLocalOptions->SetMatchWholeCell( aBtnMatch.IsChecked() );
pLocalOptions->SetFormulaRegexEnabled( aBtnRegex.IsChecked() );
pLocalOptions->SetLookUpColRowNames( aBtnLookUp.IsChecked() );
+ if (aBtnGeneralPrec.IsChecked())
+ pLocalOptions->SetStdPrecision(
+ static_cast<sal_uInt16>(aEdPrec.GetValue()) );
+ else
+ pLocalOptions->SetStdPrecision( SvNumberFormatter::UNLIMITED_PRECISION );
+
if ( *pLocalOptions != *pOldOptions )
{
rCoreAttrs.Put( ScTpCalcItem( nWhichCalc, *pLocalOptions ) );
@@ -245,19 +266,35 @@ IMPL_LINK( ScTpCalcOptions, RadioClickHdl, RadioButton*, pBtn )
//-----------------------------------------------------------------------
-IMPL_LINK( ScTpCalcOptions, CheckClickHdl, CheckBox*, pBtn )
+IMPL_LINK( ScTpCalcOptions, CheckClickHdl, CheckBox*, pBtn )
{
- if ( pBtn->IsChecked() )
+ if (pBtn == &aBtnGeneralPrec)
{
- pLocalOptions->SetIter( TRUE );
- aFtSteps.Enable(); aEdSteps.Enable();
- aFtEps .Enable(); aEdEps .Enable();
+ if (pBtn->IsChecked())
+ {
+ aEdPrec.Enable();
+ aFtPrec.Enable();
+ }
+ else
+ {
+ aEdPrec.Disable();
+ aFtPrec.Disable();
+ }
}
- else
+ else if (pBtn == &aBtnIterate)
{
- pLocalOptions->SetIter( FALSE );
- aFtSteps.Disable(); aEdSteps.Disable();
- aFtEps .Disable(); aEdEps .Disable();
+ if ( pBtn->IsChecked() )
+ {
+ pLocalOptions->SetIter( TRUE );
+ aFtSteps.Enable(); aEdSteps.Enable();
+ aFtEps .Enable(); aEdEps .Enable();
+ }
+ else
+ {
+ pLocalOptions->SetIter( FALSE );
+ aFtSteps.Disable(); aEdSteps.Disable();
+ aFtEps .Disable(); aEdEps .Disable();
+ }
}
return 0;
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 1cc66ca13af6..bbf20c436065 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -927,10 +927,6 @@ Resource RID_GLOBSTR
/* END error constants and error strings. */
- String STR_ODER_SO
- {
- Text [ en-US ] = "%s or similar" ;
- };
String STR_GRIDCOLOR
{
Text [ en-US ] = "Grid color" ;
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index 8c9279a602c1..06a19af7a8a7 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -154,11 +154,6 @@ ModalDialog RID_SCDLG_INSCELL
};
};
-Bitmap RID_SCTEAMDLGBMP1
-{
- File = "calcteam.bmp";
-};
-
ModalDialog RID_SCDLG_DELCONT
{
OutputSize = TRUE ;
@@ -1331,18 +1326,6 @@ ModalDialog RID_SCDLG_NAMES_PASTE
Text [ en-US ] = "Insert Name" ;
};
-FloatingWindow RID_SCDLG_TEAM
-{
- Hide = TRUE ;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- Zoomable = TRUE ;
- FixedBitmap 1 { Pos = MAP_APPFONT ( 1 , 1 ) ; };
- Text [ en-US ] = "The %PRODUCTNAME Calc Team" ;
-};
-
ModalDialog RID_SCDLG_CHARTCOLROW
{
OutputSize = TRUE ;
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index 856463e27e40..ea7cabf7716d 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -119,22 +119,6 @@ TabPage RID_SCPAGE_CALC
Pos = MAP_APPFONT ( 6 , 64 ) ;
Size = MAP_APPFONT ( 248 , 8 ) ;
};
- FixedText FT_PREC
- {
- Pos = MAP_APPFONT ( 150 , 77 ) ;
- Size = MAP_APPFONT ( 72 , 8 ) ;
- Text [ en-US ] = "~Decimal places" ;
- Right = TRUE ;
- };
- NumericField ED_PREC
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 226 , 75 ) ;
- Size = MAP_APPFONT ( 25 , 12 ) ;
- Maximum = 20 ;
- Spin = TRUE ;
- Repeat = TRUE ;
- };
CheckBox BTN_CASE
{
Pos = MAP_APPFONT ( 12 , 77 ) ;
@@ -165,6 +149,28 @@ TabPage RID_SCPAGE_CALC
Size = MAP_APPFONT ( 239 , 10 ) ;
Text [ en-US ] = "~Automatically find column and row labels " ;
};
+ CheckBox BTN_GENERAL_PREC
+ {
+ Pos = MAP_APPFONT ( 12 , 147 ) ;
+ Size = MAP_APPFONT ( 136 , 10 ) ;
+ Text [ en-US ] = "Limit decimals for general number format" ;
+ };
+ FixedText FT_PREC
+ {
+ Pos = MAP_APPFONT ( 150 , 148 ) ;
+ Size = MAP_APPFONT ( 72 , 8 ) ;
+ Text [ en-US ] = "~Decimal places" ;
+ Right = TRUE ;
+ };
+ NumericField ED_PREC
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 226 , 146 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ Maximum = 20 ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
};
/**************************************************************************/
diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx
index 141a7d0abb73..f3f76685e5cb 100644
--- a/sc/source/ui/unoobj/defltuno.cxx
+++ b/sc/source/ui/unoobj/defltuno.cxx
@@ -46,6 +46,8 @@
#include "unonames.hxx"
#include "docoptio.hxx"
+#include <limits>
+
using namespace ::com::sun::star;
//------------------------------------------------------------------------
@@ -157,7 +159,7 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue(
sal_Int16 nValue = 0;
if (aValue >>= nValue)
{
- aDocOpt.SetStdPrecision(static_cast<sal_uInt8> (nValue));
+ aDocOpt.SetStdPrecision(static_cast<sal_uInt16> (nValue));
pDoc->SetDocOptions(aDocOpt);
}
}
@@ -250,7 +252,12 @@ uno::Any SAL_CALL ScDocDefaultsObj::getPropertyValue( const rtl::OUString& aProp
if (pDoc)
{
const ScDocOptions& aDocOpt = pDoc->GetDocOptions();
- aRet <<= static_cast<sal_Int16> (aDocOpt.GetStdPrecision());
+ sal_uInt16 nPrec = aDocOpt.GetStdPrecision();
+ // the max value of unsigned 16-bit integer is used as the flag
+ // value for unlimited precision, c.f.
+ // SvNumberFormatter::UNLIMITED_PRECISION.
+ if (nPrec <= ::std::numeric_limits<sal_Int16>::max())
+ aRet <<= static_cast<sal_Int16> (nPrec);
}
else
throw uno::RuntimeException();
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index e67103cf75e5..d9fb4d53e634 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1040,18 +1040,21 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32
Size aTwips = aFunc.GetPageSize();
awt::Size aPageSize( TwipsToHMM( aTwips.Width() ), TwipsToHMM( aTwips.Height() ) );
- long nPropCount = bWasCellRange ? 2 : 1;
+ long nPropCount = bWasCellRange ? 3 : 2;
uno::Sequence<beans::PropertyValue> aSequence(nPropCount);
beans::PropertyValue* pArray = aSequence.getArray();
pArray[0].Name = rtl::OUString::createFromAscii( SC_UNONAME_PAGESIZE );
pArray[0].Value <<= aPageSize;
+ // #i111158# all positions are relative to the whole page, including non-printable area
+ pArray[1].Name = rtl::OUString::createFromAscii( SC_UNONAME_INC_NP_AREA );
+ pArray[1].Value = uno::makeAny( sal_True );
if ( bWasCellRange )
{
table::CellRangeAddress aRangeAddress( nTab,
aCellRange.aStart.Col(), aCellRange.aStart.Row(),
aCellRange.aEnd.Col(), aCellRange.aEnd.Row() );
- pArray[1].Name = rtl::OUString::createFromAscii( SC_UNONAME_SOURCERANGE );
- pArray[1].Value <<= aRangeAddress;
+ pArray[2].Name = rtl::OUString::createFromAscii( SC_UNONAME_SOURCERANGE );
+ pArray[2].Value <<= aRangeAddress;
}
#if 0
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index 8591f2fc0801..efe804784a40 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -185,7 +185,9 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
}
else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() )
{
- if (!bExport)
+ if (bExport)
+ nRet = ui::dialogs::ExecutableDialogResults::OK; // export HTML without dialog
+ else
{
// HTML import.
::std::auto_ptr<AbstractScTextImportOptionsDlg> pDlg(
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 474d07764127..75686df460d6 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -340,7 +340,7 @@ uno::Reference<table::XCellRange> SAL_CALL ScNamedRangeObj::getReferredCells()
ScUnoGuard aGuard;
ScRange aRange;
ScRangeData* pData = GetRangeData_Impl();
- if ( pData && pData->IsReference( aRange ) )
+ if ( pData && pData->IsValidReference( aRange ) )
{
//! static Funktion um ScCellObj/ScCellRangeObj zu erzeugen am ScCellRangeObj ???
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index cded62efa3a8..80cb88595b11 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -256,6 +256,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
sal_Int32 nIndexOfReadOnlyFlag = -1;
sal_Int32 nIndexOfTemplateFlag = -1;
sal_Int32 nIndexOfDocumentTitle = -1;
+ bool bFakeXLS = false;
for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
{
@@ -436,8 +437,11 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
}
else
{
+ bool bIsXLS = false;
SvStream* pStream = aMedium.GetInStream();
const SfxFilter* pPreselectedFilter = pFilter;
+ if ( pPreselectedFilter && pPreselectedFilter->GetName().SearchAscii("Excel") != STRING_NOTFOUND )
+ bIsXLS = true;
pFilter = 0;
if ( pStream )
{
@@ -718,7 +722,8 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
// further checks for filters only if they are preselected: ASCII, HTML, RTF, DBase
// without the preselection other filters (Writer) take precedence
// DBase can't be detected reliably, so it also needs preselection
- if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) && lcl_MayBeAscii( rStr ) )
+ bool bMaybeText = lcl_MayBeAscii( rStr );
+ if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) && bMaybeText )
{
// Text filter is accepted if preselected
pFilter = pPreselectedFilter;
@@ -747,8 +752,15 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
else
{
pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterHtmlWeb) );
+ if ( bIsXLS )
+ bFakeXLS = true;
}
}
+ else if ( bIsXLS && bMaybeText )
+ {
+ pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterAscii) );
+ bFakeXLS = true;
+ }
else if ( aHeader.CompareTo( "{\\rtf", 5 ) == COMPARE_EQUAL )
{
// test for RTF
@@ -834,6 +846,19 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
lDescriptor[nIndexOfDocumentTitle].Value <<= aDocumentTitle;
}
+ if ( bFakeXLS )
+ {
+ if ( nIndexOfFilterName == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("FilterName");
+ lDescriptor[nPropertyCount].Value <<= rtl::OUString(pFilter->GetName());
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfFilterName].Value <<= rtl::OUString(pFilter->GetName());
+ }
+
if ( pFilter )
aTypeName = pFilter->GetTypeName();
else
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 406fdab9c824..35befa8f7a36 100755
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1739,6 +1739,18 @@ void lcl_MoveToEnd( ScDPSaveDimension& rDim, const String& rItemName )
// puts it to the end of the list even if it was in the list before.
}
+struct ScOUStringCollate
+{
+ CollatorWrapper* mpCollator;
+
+ ScOUStringCollate(CollatorWrapper* pColl) : mpCollator(pColl) {}
+
+ bool operator()(const rtl::OUString& rStr1, const rtl::OUString& rStr2) const
+ {
+ return ( mpCollator->compareString(rStr1, rStr2) < 0 );
+ }
+};
+
bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16* pUserListId )
{
ScDocument* pDoc = GetViewData()->GetDocument();
@@ -1747,7 +1759,8 @@ bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16
return false;
// We need to run this to get all members later.
- pDPObj->BuildAllDimensionMembers();
+ if ( pUserListId )
+ pDPObj->BuildAllDimensionMembers();
USHORT nOrientation;
long nDimIndex = pDPObj->GetHeaderDim(rPos, nOrientation);
@@ -1766,97 +1779,111 @@ bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16
if (!pSaveDim)
return false;
- typedef ScDPSaveDimension::MemberList MemList;
- const MemList& rDimMembers = pSaveDim->GetMembers();
- list<OUString> aMembers;
- hash_set<OUString, ::rtl::OUStringHash> aMemberSet;
- size_t nMemberCount = 0;
- for (MemList::const_iterator itr = rDimMembers.begin(), itrEnd = rDimMembers.end();
- itr != itrEnd; ++itr)
+ // manual evaluation of sort order is only needed if a user list id is given
+ if ( pUserListId )
{
- ScDPSaveMember* pMem = *itr;
- aMembers.push_back(pMem->GetName());
- aMemberSet.insert(pMem->GetName());
- ++nMemberCount;
- }
-
- // Sort the member list in ascending order.
- aMembers.sort();
+ typedef ScDPSaveDimension::MemberList MemList;
+ const MemList& rDimMembers = pSaveDim->GetMembers();
+ list<OUString> aMembers;
+ hash_set<OUString, ::rtl::OUStringHash> aMemberSet;
+ size_t nMemberCount = 0;
+ for (MemList::const_iterator itr = rDimMembers.begin(), itrEnd = rDimMembers.end();
+ itr != itrEnd; ++itr)
+ {
+ ScDPSaveMember* pMem = *itr;
+ aMembers.push_back(pMem->GetName());
+ aMemberSet.insert(pMem->GetName());
+ ++nMemberCount;
+ }
- // Collect and rank those custom sort strings that also exist in the member name list.
+ // Sort the member list in ascending order.
+ ScOUStringCollate aCollate( ScGlobal::GetCollator() );
+ aMembers.sort(aCollate);
- typedef hash_map<OUString, sal_uInt16, OUStringHash> UserSortMap;
- UserSortMap aSubStrs;
- sal_uInt16 nSubCount = 0;
- if (pUserListId)
- {
- ScUserList* pUserList = ScGlobal::GetUserList();
- if (!pUserList)
- return false;
+ // Collect and rank those custom sort strings that also exist in the member name list.
+ typedef hash_map<OUString, sal_uInt16, OUStringHash> UserSortMap;
+ UserSortMap aSubStrs;
+ sal_uInt16 nSubCount = 0;
+ if (pUserListId)
{
- sal_uInt16 n = pUserList->GetCount();
- if (!n || *pUserListId >= n)
+ ScUserList* pUserList = ScGlobal::GetUserList();
+ if (!pUserList)
return false;
- }
- ScUserListData* pData = static_cast<ScUserListData*>((*pUserList)[*pUserListId]);
- if (pData)
- {
- sal_uInt16 n = pData->GetSubCount();
- for (sal_uInt16 i = 0; i < n; ++i)
{
- OUString aSub = pData->GetSubStr(i);
- if (!aMemberSet.count(aSub))
- // This string doesn't exist in the member name set. Don't add this.
- continue;
+ sal_uInt16 n = pUserList->GetCount();
+ if (!n || *pUserListId >= n)
+ return false;
+ }
+
+ ScUserListData* pData = static_cast<ScUserListData*>((*pUserList)[*pUserListId]);
+ if (pData)
+ {
+ sal_uInt16 n = pData->GetSubCount();
+ for (sal_uInt16 i = 0; i < n; ++i)
+ {
+ OUString aSub = pData->GetSubStr(i);
+ if (!aMemberSet.count(aSub))
+ // This string doesn't exist in the member name set. Don't add this.
+ continue;
- aSubStrs.insert(UserSortMap::value_type(aSub, nSubCount++));
+ aSubStrs.insert(UserSortMap::value_type(aSub, nSubCount++));
+ }
}
}
- }
- // Rank all members.
+ // Rank all members.
- vector<OUString> aRankedNames(nMemberCount);
- sal_uInt16 nCurStrId = 0;
- for (list<OUString>::const_iterator itr = aMembers.begin(), itrEnd = aMembers.end();
- itr != itrEnd; ++itr)
- {
- OUString aName = *itr;
- sal_uInt16 nRank = 0;
- UserSortMap::const_iterator itrSub = aSubStrs.find(aName);
- if (itrSub == aSubStrs.end())
- nRank = nSubCount + nCurStrId++;
- else
- nRank = itrSub->second;
+ vector<OUString> aRankedNames(nMemberCount);
+ sal_uInt16 nCurStrId = 0;
+ for (list<OUString>::const_iterator itr = aMembers.begin(), itrEnd = aMembers.end();
+ itr != itrEnd; ++itr)
+ {
+ OUString aName = *itr;
+ sal_uInt16 nRank = 0;
+ UserSortMap::const_iterator itrSub = aSubStrs.find(aName);
+ if (itrSub == aSubStrs.end())
+ nRank = nSubCount + nCurStrId++;
+ else
+ nRank = itrSub->second;
- if (!bAscending)
- nRank = static_cast< sal_uInt16 >( nMemberCount - nRank - 1 );
+ if (!bAscending)
+ nRank = static_cast< sal_uInt16 >( nMemberCount - nRank - 1 );
- aRankedNames[nRank] = aName;
- }
+ aRankedNames[nRank] = aName;
+ }
- // Re-order ScDPSaveMember instances with the new ranks.
+ // Re-order ScDPSaveMember instances with the new ranks.
- for (vector<OUString>::const_iterator itr = aRankedNames.begin(), itrEnd = aRankedNames.end();
- itr != itrEnd; ++itr)
- {
- const ScDPSaveMember* pOldMem = pSaveDim->GetExistingMemberByName(*itr);
- if (!pOldMem)
- // All members are supposed to be present.
- continue;
+ for (vector<OUString>::const_iterator itr = aRankedNames.begin(), itrEnd = aRankedNames.end();
+ itr != itrEnd; ++itr)
+ {
+ const ScDPSaveMember* pOldMem = pSaveDim->GetExistingMemberByName(*itr);
+ if (!pOldMem)
+ // All members are supposed to be present.
+ continue;
- ScDPSaveMember* pNewMem = new ScDPSaveMember(*pOldMem);
- pSaveDim->AddMember(pNewMem);
- }
+ ScDPSaveMember* pNewMem = new ScDPSaveMember(*pOldMem);
+ pSaveDim->AddMember(pNewMem);
+ }
- // Set the sorting mode to manual for now. We may introduce a new sorting
- // mode later on.
+ // Set the sorting mode to manual for now. We may introduce a new sorting
+ // mode later on.
- sheet::DataPilotFieldSortInfo aSortInfo;
- aSortInfo.Mode = sheet::DataPilotFieldSortMode::MANUAL;
- pSaveDim->SetSortInfo(&aSortInfo);
+ sheet::DataPilotFieldSortInfo aSortInfo;
+ aSortInfo.Mode = sheet::DataPilotFieldSortMode::MANUAL;
+ pSaveDim->SetSortInfo(&aSortInfo);
+ }
+ else
+ {
+ // without user list id, just apply sorting mode
+
+ sheet::DataPilotFieldSortInfo aSortInfo;
+ aSortInfo.Mode = sheet::DataPilotFieldSortMode::NAME;
+ aSortInfo.IsAscending = bAscending;
+ pSaveDim->SetSortInfo(&aSortInfo);
+ }
// Update the datapilot with the newly sorted field members.
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 311bcf8c24b2..cc09722530ad 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -397,13 +397,13 @@ void ScDrawView::MarkListHasChanged()
ScTabViewShell* pViewSh = pViewData->GetViewShell();
- if (!bInConstruct) // nicht wenn die View gerade angelegt wird
+ // #i110829# remove the cell selection only if drawing objects are selected
+ if ( !bInConstruct && GetMarkedObjectList().GetMarkCount() )
{
- pViewSh->Unmark(); // Selektion auff'm Doc entfernen
+ pViewSh->Unmark(); // remove cell selection
// #65379# end cell edit mode if drawing objects are selected
- if ( GetMarkedObjectList().GetMarkCount() )
- SC_MOD()->InputEnterHandler();
+ SC_MOD()->InputEnterHandler();
}
// IP deaktivieren
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 53851f0e3cf0..5a48d0d310d5 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -53,6 +53,7 @@
#include <editeng/udlnitem.hxx>
#include <editeng/unolingu.hxx>
#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
#include <vcl/svapp.hxx>
#include <vcl/metric.hxx>
#include <vcl/outdev.hxx>
@@ -74,6 +75,8 @@
#include "scmod.hxx"
#include "fillinfo.hxx"
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include <math.h>
//! Autofilter-Breite mit column.cxx zusammenfassen
@@ -108,6 +111,9 @@ class ScDrawStringsVars
String aString; // Inhalte
Size aTextSize;
long nOriginalWidth;
+ long nMaxDigitWidth;
+ long nSignWidth;
+ long nDotWidth;
ScBaseCell* pLastCell;
ULONG nValueFormat;
@@ -132,7 +138,7 @@ public:
void SetPatternSimple( const ScPatternAttr* pNew, const SfxItemSet* pSet );
BOOL SetText( ScBaseCell* pCell ); // TRUE -> pOldPattern vergessen
- void SetHashText();
+ void SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth );
void SetAutoText( const String& rAutoText );
const ScPatternAttr* GetPattern() const { return pPattern; }
@@ -161,6 +167,14 @@ public:
pCondSet->GetItemState( ATTR_FONT_HEIGHT, TRUE ); }
BOOL HasEditCharacters() const;
+
+private:
+ void SetHashText();
+ long GetMaxDigitWidth();
+ long GetSignWidth();
+ long GetDotWidth();
+ void TextChanged();
+ long ConvertWidthLogicToPixel( long nWidth ) const;
};
//==================================================================
@@ -176,6 +190,9 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, BOOL bPTL) :
nIndent ( 0 ),
bRotated ( FALSE ),
nOriginalWidth( 0 ),
+ nMaxDigitWidth( 0 ),
+ nSignWidth( 0 ),
+ nDotWidth( 0 ),
pLastCell ( NULL ),
nValueFormat( 0 ),
bLineBreak ( FALSE ),
@@ -242,6 +259,10 @@ void ScDrawStringsVars::SetShrinkScale( long nScale, BYTE nScript )
void ScDrawStringsVars::SetPattern( const ScPatternAttr* pNew, const SfxItemSet* pSet,
ScBaseCell* pCell, BYTE nScript )
{
+ nMaxDigitWidth = 0;
+ nSignWidth = 0;
+ nDotWidth = 0;
+
pPattern = pNew;
pCondSet = pSet;
@@ -393,6 +414,9 @@ void ScDrawStringsVars::SetPattern( const ScPatternAttr* pNew, const SfxItemSet*
void ScDrawStringsVars::SetPatternSimple( const ScPatternAttr* pNew, const SfxItemSet* pSet )
{
+ nMaxDigitWidth = 0;
+ nSignWidth = 0;
+ nDotWidth = 0;
// wird gerufen, wenn sich die Font-Variablen nicht aendern (!StringDiffer)
pPattern = pNew;
@@ -467,28 +491,7 @@ BOOL ScDrawStringsVars::SetText( ScBaseCell* pCell )
pLastCell = NULL; // naechstes Mal wieder hierherkommen
}
- OutputDevice* pRefDevice = pOutput->pRefDevice;
- OutputDevice* pFmtDevice = pOutput->pFmtDevice;
- aTextSize.Width() = pFmtDevice->GetTextWidth( aString );
- aTextSize.Height() = pFmtDevice->GetTextHeight();
-
- if ( !pRefDevice->GetConnectMetaFile() || pRefDevice->GetOutDevType() == OUTDEV_PRINTER )
- {
- double fMul = pOutput->GetStretch();
- aTextSize.Width() = (long)(aTextSize.Width() / fMul + 0.5);
- }
-
- aTextSize.Height() = aMetric.GetAscent() + aMetric.GetDescent();
- if ( GetOrient() != SVX_ORIENTATION_STANDARD )
- {
- long nTemp = aTextSize.Height();
- aTextSize.Height() = aTextSize.Width();
- aTextSize.Width() = nTemp;
- }
-
- nOriginalWidth = aTextSize.Width();
- if ( bPixelToLogic )
- aTextSize = pRefDevice->LogicToPixel( aTextSize );
+ TextChanged();
}
// sonst String/Groesse behalten
}
@@ -508,6 +511,82 @@ void ScDrawStringsVars::SetHashText()
SetAutoText( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("###")) );
}
+void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
+{
+ if (!pCell)
+ return;
+
+ CellType eType = pCell->GetCellType();
+ if (eType != CELLTYPE_VALUE && eType != CELLTYPE_FORMULA)
+ // must be a value or formula cell.
+ return;
+
+ if (eType == CELLTYPE_FORMULA && !static_cast<ScFormulaCell*>(pCell)->IsValue())
+ // If it's formula, the result must be a value.
+ return;
+
+ ULONG nFormat = GetValueFormat();
+ if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0)
+ {
+ // Not 'General' number format. Set hash text and bail out.
+ SetHashText();
+ return;
+ }
+
+ double fVal = (eType == CELLTYPE_VALUE) ?
+ static_cast<ScValueCell*>(pCell)->GetValue() : static_cast<ScFormulaCell*>(pCell)->GetValue();
+
+ const SvNumberformat* pNumFormat = pOutput->pDoc->GetFormatTable()->GetEntry(nFormat);
+ if (!pNumFormat)
+ return;
+
+ long nMaxDigit = GetMaxDigitWidth();
+ sal_uInt16 nNumDigits = static_cast<sal_uInt16>(nWidth / nMaxDigit);
+
+ if (!pNumFormat->GetOutputString(fVal, nNumDigits, aString))
+ // Failed to get output string. Bail out.
+ return;
+
+ sal_uInt8 nSignCount = 0, nDecimalCount = 0;
+ xub_StrLen nLen = aString.Len();
+ sal_Unicode cDecSep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator.getStr()[0];
+ for (xub_StrLen i = 0; i < nLen; ++i)
+ {
+ sal_Unicode c = aString.GetChar(i);
+ if (c == sal_Unicode('-'))
+ ++nSignCount;
+ else if (c == cDecSep)
+ ++nDecimalCount;
+ }
+ if (nDecimalCount)
+ nWidth += (nMaxDigit - GetDotWidth()) * nDecimalCount;
+ if (nSignCount)
+ nWidth += (nMaxDigit - GetSignWidth()) * nSignCount;
+
+ if (nDecimalCount || nSignCount)
+ {
+ // Re-calculate.
+ nNumDigits = static_cast<sal_uInt16>(nWidth / nMaxDigit);
+ if (!pNumFormat->GetOutputString(fVal, nNumDigits, aString))
+ // Failed to get output string. Bail out.
+ return;
+ }
+
+ long nActualTextWidth = pOutput->pFmtDevice->GetTextWidth(aString);
+
+ if (bPixelToLogic)
+ nActualTextWidth = ConvertWidthLogicToPixel(nActualTextWidth);
+
+ if (nActualTextWidth > nWidth)
+ {
+ // Even after the decimal adjustment the text doesn't fit. Give up.
+ SetHashText();
+ return;
+ }
+
+ TextChanged();
+}
+
void ScDrawStringsVars::SetAutoText( const String& rAutoText )
{
aString = rAutoText;
@@ -538,6 +617,80 @@ void ScDrawStringsVars::SetAutoText( const String& rAutoText )
pLastCell = NULL; // derselbe Text kann in der naechsten Zelle wieder passen
}
+long ScDrawStringsVars::GetMaxDigitWidth()
+{
+ if (nMaxDigitWidth > 0)
+ return nMaxDigitWidth;
+
+ sal_Char cZero = '0';
+ for (int i = 0; i < 10; ++i)
+ {
+ sal_Char cDigit = cZero + i;
+ long n = pOutput->pFmtDevice->GetTextWidth(String(cDigit));
+ nMaxDigitWidth = ::std::max(nMaxDigitWidth, n);
+ }
+
+ if (bPixelToLogic)
+ nMaxDigitWidth = ConvertWidthLogicToPixel(nMaxDigitWidth);
+ return nMaxDigitWidth;
+}
+
+long ScDrawStringsVars::GetSignWidth()
+{
+ if (nSignWidth > 0)
+ return nSignWidth;
+
+ nSignWidth = pOutput->pFmtDevice->GetTextWidth(String('-'));
+ if (bPixelToLogic)
+ nSignWidth = ConvertWidthLogicToPixel(nSignWidth);
+ return nSignWidth;
+}
+
+long ScDrawStringsVars::GetDotWidth()
+{
+ if (nDotWidth > 0)
+ return nDotWidth;
+
+ const ::rtl::OUString& sep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator;
+ nDotWidth = pOutput->pFmtDevice->GetTextWidth(sep);
+ if (bPixelToLogic)
+ nDotWidth = ConvertWidthLogicToPixel(nDotWidth);
+ return nDotWidth;
+}
+
+void ScDrawStringsVars::TextChanged()
+{
+ OutputDevice* pRefDevice = pOutput->pRefDevice;
+ OutputDevice* pFmtDevice = pOutput->pFmtDevice;
+ aTextSize.Width() = pFmtDevice->GetTextWidth( aString );
+ aTextSize.Height() = pFmtDevice->GetTextHeight();
+
+ if ( !pRefDevice->GetConnectMetaFile() || pRefDevice->GetOutDevType() == OUTDEV_PRINTER )
+ {
+ double fMul = pOutput->GetStretch();
+ aTextSize.Width() = (long)(aTextSize.Width() / fMul + 0.5);
+ }
+
+ aTextSize.Height() = aMetric.GetAscent() + aMetric.GetDescent();
+ if ( GetOrient() != SVX_ORIENTATION_STANDARD )
+ {
+ long nTemp = aTextSize.Height();
+ aTextSize.Height() = aTextSize.Width();
+ aTextSize.Width() = nTemp;
+ }
+
+ nOriginalWidth = aTextSize.Width();
+ if ( bPixelToLogic )
+ aTextSize = pRefDevice->LogicToPixel( aTextSize );
+}
+
+long ScDrawStringsVars::ConvertWidthLogicToPixel( long nWidth ) const
+{
+ Size aSize(nWidth, pOutput->pFmtDevice->GetTextHeight());
+ aSize = pOutput->pRefDevice->LogicToPixel(aSize);
+ return aSize.Width();
+}
+
BOOL ScDrawStringsVars::HasEditCharacters() const
{
static const sal_Unicode pChars[] =
@@ -919,18 +1072,14 @@ BOOL ScOutputData::IsAvailable( SCCOL nX, SCROW nY )
// bCellIsValue: if set, don't extend into empty cells
// bBreak: if set, don't extend, and don't set clip marks (but rLeftClip/rRightClip is set)
// bOverwrite: if set, also extend into non-empty cells (for rotated text)
-// rAlignRect: output: single or merged cell, used for alignment (visual rectangle)
-// rClipRect: output: total output area, for clipping (visual)
-// rLeftClip: output: need to clip at rClipRect left (visual) edge
-// rRightClip: output: same for right
+// rParam output: various area parameters.
void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY,
- SCCOL nCellX, SCROW nCellY, long nNeeded,
- const ScPatternAttr& rPattern,
- USHORT nHorJustify, BOOL bCellIsValue,
- BOOL bBreak, BOOL bOverwrite,
- Rectangle& rAlignRect, Rectangle& rClipRect,
- BOOL& rLeftClip, BOOL& rRightClip )
+ SCCOL nCellX, SCROW nCellY, long nNeeded,
+ const ScPatternAttr& rPattern,
+ USHORT nHorJustify, bool bCellIsValue,
+ bool bBreak, bool bOverwrite,
+ OutputAreaParam& rParam )
{
// rThisRowInfo may be for a different row than nCellY, is still used for clip marks
RowInfo& rThisRowInfo = pRowInfo[nArrY];
@@ -1009,21 +1158,23 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
--nMergeSizeX; // leave out the grid horizontally, also for alignment (align between grid lines)
+ rParam.mnColWidth = nMergeSizeX; // store the actual column width.
+
//
// construct the rectangles using logical left/right values (justify is called at the end)
//
// rAlignRect is the single cell or merged area, used for alignment.
- rAlignRect.Left() = nCellPosX;
- rAlignRect.Right() = nCellPosX + ( nMergeSizeX - 1 ) * nLayoutSign;
- rAlignRect.Top() = nCellPosY;
- rAlignRect.Bottom() = nCellPosY + nMergeSizeY - 1;
+ rParam.maAlignRect.Left() = nCellPosX;
+ rParam.maAlignRect.Right() = nCellPosX + ( nMergeSizeX - 1 ) * nLayoutSign;
+ rParam.maAlignRect.Top() = nCellPosY;
+ rParam.maAlignRect.Bottom() = nCellPosY + nMergeSizeY - 1;
// rClipRect is all cells that are used for output.
// For merged cells this is the same as rAlignRect, otherwise neighboring cells can also be used.
- rClipRect = rAlignRect;
+ rParam.maClipRect = rParam.maAlignRect;
if ( nNeeded > nMergeSizeX )
{
SvxCellHorJustify eHorJust = (SvxCellHorJustify)nHorJustify;
@@ -1064,7 +1215,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
++nRightX;
long nAdd = (long) ( pDoc->GetColWidth( nRightX, nTab ) * nPPTX );
nRightMissing -= nAdd;
- rClipRect.Right() += nAdd * nLayoutSign;
+ rParam.maClipRect.Right() += nAdd * nLayoutSign;
if ( rThisRowInfo.nRowNo == nCellY && nRightX >= nX1 && nRightX <= nX2 )
rThisRowInfo.pCellInfo[nRightX].bHideGrid = TRUE;
@@ -1078,7 +1229,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
--nLeftX;
long nAdd = (long) ( pDoc->GetColWidth( nLeftX, nTab ) * nPPTX );
nLeftMissing -= nAdd;
- rClipRect.Left() -= nAdd * nLayoutSign;
+ rParam.maClipRect.Left() -= nAdd * nLayoutSign;
}
}
@@ -1089,22 +1240,22 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
rThisRowInfo.pCellInfo[nRightX+1].nClipMark |= SC_CLIPMARK_RIGHT;
bAnyClipped = TRUE;
long nMarkPixel = (long)( SC_CLIPMARK_SIZE * nPPTX );
- rClipRect.Right() -= nMarkPixel * nLayoutSign;
+ rParam.maClipRect.Right() -= nMarkPixel * nLayoutSign;
}
if ( nLeftMissing > 0 && bMarkClipped && nLeftX >= nX1 && nLeftX <= nX2 && !bBreak && !bCellIsValue )
{
rThisRowInfo.pCellInfo[nLeftX+1].nClipMark |= SC_CLIPMARK_LEFT;
bAnyClipped = TRUE;
long nMarkPixel = (long)( SC_CLIPMARK_SIZE * nPPTX );
- rClipRect.Left() += nMarkPixel * nLayoutSign;
+ rParam.maClipRect.Left() += nMarkPixel * nLayoutSign;
}
- rLeftClip = ( nLeftMissing > 0 );
- rRightClip = ( nRightMissing > 0 );
+ rParam.mbLeftClip = ( nLeftMissing > 0 );
+ rParam.mbRightClip = ( nRightMissing > 0 );
}
else
{
- rLeftClip = rRightClip = FALSE;
+ rParam.mbLeftClip = rParam.mbRightClip = FALSE;
// leave space for AutoFilter on screen
// (for automatic line break: only if not formatting for printer, as in ScColumn::GetNeededSize)
@@ -1120,30 +1271,30 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
// content fits even in the remaining area without the filter button
// -> align within that remaining area
- rAlignRect.Right() -= nFilter * nLayoutSign;
- rClipRect.Right() -= nFilter * nLayoutSign;
+ rParam.maAlignRect.Right() -= nFilter * nLayoutSign;
+ rParam.maClipRect.Right() -= nFilter * nLayoutSign;
// if a number doesn't fit, don't hide part of the number behind the button
// -> set clip flags, so "###" replacement is used (but also within the smaller area)
if ( !bFit )
- rLeftClip = rRightClip = TRUE;
+ rParam.mbLeftClip = rParam.mbRightClip = TRUE;
}
}
}
// justify both rectangles for alignment calculation, use with DrawText etc.
- rAlignRect.Justify();
- rClipRect.Justify();
+ rParam.maAlignRect.Justify();
+ rParam.maClipRect.Justify();
#if 0
//! Test !!!
pDev->Push();
pDev->SetLineColor();
pDev->SetFillColor( COL_LIGHTGREEN );
- pDev->DrawRect( pDev->PixelToLogic(rClipRect) );
- pDev->DrawRect( rClipRect ); // print preview
+ pDev->DrawRect( pDev->PixelToLogic(rParam.maClipRect) );
+ pDev->DrawRect( rParam.maClipRect ); // print preview
pDev->Pop();
//! Test !!!
#endif
@@ -1164,10 +1315,6 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
ScDrawStringsVars aVars( this, bPixelToLogic );
- const ScPatternAttr* pOldPattern = NULL;
- const SfxItemSet* pOldCondSet = NULL;
- BYTE nOldScript = 0;
-
BOOL bProgress = FALSE;
long nInitPosX = nScrX;
@@ -1184,15 +1331,19 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
--nLoopStartX; // start before nX1 for rest of long text to the left
// variables for GetOutputArea
+ OutputAreaParam aAreaParam;
BOOL bCellIsValue = FALSE;
- BOOL bLeftClip = FALSE;
- BOOL bRightClip = FALSE;
long nNeededWidth = 0;
- Rectangle aAlignRect;
- Rectangle aClipRect;
SvxCellHorJustify eOutHorJust = SVX_HOR_JUSTIFY_STANDARD;
const ScPatternAttr* pPattern = NULL;
const SfxItemSet* pCondSet = NULL;
+ const ScPatternAttr* pOldPattern = NULL;
+ const SfxItemSet* pOldCondSet = NULL;
+ BYTE nOldScript = 0;
+
+ // alternative pattern instances in case we need to modify the pattern
+ // before processing the cell value.
+ ::boost::ptr_vector<ScPatternAttr> aAltPatterns;
long nPosY = nScrY;
for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
@@ -1330,6 +1481,18 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
pCondSet = pDoc->GetCondResult( nCellX, nCellY, nTab );
}
+ if (pCell->HasValueData() &&
+ static_cast<const SfxBoolItem&>(
+ pPattern->GetItem(ATTR_LINEBREAK, pCondSet)).GetValue())
+ {
+ // Disable line break when the cell content is numeric.
+ aAltPatterns.push_back(new ScPatternAttr(*pPattern));
+ ScPatternAttr* pAltPattern = &aAltPatterns.back();
+ SfxBoolItem aLineBreak(ATTR_LINEBREAK, false);
+ pAltPattern->GetItemSet().Put(aLineBreak);
+ pPattern = pAltPattern;
+ }
+
BYTE nScript = GetScriptType( pDoc, pCell, pPattern, pCondSet );
if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
if ( pPattern != pOldPattern || pCondSet != pOldCondSet ||
@@ -1360,6 +1523,7 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
bNeedEdit = aVars.HasEditCharacters() ||
(bFormulaCell && ((ScFormulaCell*)pCell)->IsMultilineResult());
}
+ long nTotalMargin = 0;
if (bDoCell && !bNeedEdit)
{
CellType eCellType = pCell->GetCellType();
@@ -1381,14 +1545,17 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
BOOL bRepeat = aVars.IsRepeat() && !bBreak;
BOOL bShrink = aVars.IsShrink() && !bBreak && !bRepeat;
- long nTotalMargin = (long) ( aVars.GetLeftTotal() * nPPTX ) +
- (long) ( aVars.GetMargin()->GetRightMargin() * nPPTX );
+ nTotalMargin =
+ static_cast<long>(aVars.GetLeftTotal() * nPPTX) +
+ static_cast<long>(aVars.GetMargin()->GetRightMargin() * nPPTX);
+
nNeededWidth = aVars.GetTextSize().Width() + nTotalMargin;
+
// GetOutputArea gives justfied rectangles
GetOutputArea( nX, nArrY, nPosX, nPosY, nCellX, nCellY, nNeededWidth,
- *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
- bCellIsValue || bRepeat || bShrink, bBreak, FALSE,
- aAlignRect, aClipRect, bLeftClip, bRightClip );
+ *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
+ bCellIsValue || bRepeat || bShrink, bBreak, FALSE,
+ aAreaParam );
if ( bShrink )
{
@@ -1398,9 +1565,9 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
// DrawEdit is used to vertically scale 90 deg rotated text.
bNeedEdit = TRUE;
}
- else if ( bLeftClip || bRightClip ) // horizontal
+ else if ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip ) // horizontal
{
- long nAvailable = aAlignRect.GetWidth() - nTotalMargin;
+ long nAvailable = aAreaParam.maAlignRect.GetWidth() - nTotalMargin;
long nScaleSize = aVars.GetTextSize().Width(); // without margin
if ( nScaleSize > 0 ) // 0 if the text is empty (formulas, number formats)
@@ -1424,16 +1591,16 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
// If even at half the size the font still isn't rendered smaller,
// fall back to normal clipping (showing ### for numbers).
if ( nNewSize <= nAvailable )
- bLeftClip = bRightClip = FALSE;
+ aAreaParam.mbLeftClip = aAreaParam.mbRightClip = FALSE;
pOldPattern = NULL;
}
}
}
- if ( bRepeat && !bLeftClip && !bRightClip )
+ if ( bRepeat && !aAreaParam.mbLeftClip && !aAreaParam.mbRightClip )
{
- long nAvailable = aAlignRect.GetWidth() - nTotalMargin;
+ long nAvailable = aAreaParam.maAlignRect.GetWidth() - nTotalMargin;
long nRepeatSize = aVars.GetTextSize().Width(); // without margin
// When formatting for the printer, the text sizes don't always add up.
// Round down (too few repetitions) rather than exceeding the cell size then:
@@ -1457,13 +1624,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
if ( bBreak )
{
if ( aVars.GetOrient() == SVX_ORIENTATION_STANDARD )
- bNeedEdit = ( bLeftClip || bRightClip );
+ bNeedEdit = ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip );
else
{
long nHeight = aVars.GetTextSize().Height() +
(long)(aVars.GetMargin()->GetTopMargin()*nPPTY) +
(long)(aVars.GetMargin()->GetBottomMargin()*nPPTY);
- bNeedEdit = ( nHeight > aClipRect.GetHeight() );
+ bNeedEdit = ( nHeight > aAreaParam.maClipRect.GetHeight() );
}
}
}
@@ -1479,48 +1646,49 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
}
if ( bDoCell )
{
- if ( bCellIsValue && ( bLeftClip || bRightClip ) )
+ if ( bCellIsValue && ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip ) )
{
- aVars.SetHashText();
+ // Adjust the decimals to fit the available column width.
+ aVars.SetTextToWidthOrHash(pCell, aAreaParam.mnColWidth - nTotalMargin);
nNeededWidth = aVars.GetTextSize().Width() +
(long) ( aVars.GetLeftTotal() * nPPTX ) +
(long) ( aVars.GetMargin()->GetRightMargin() * nPPTX );
- if ( nNeededWidth <= aClipRect.GetWidth() )
- bLeftClip = bRightClip = FALSE;
+ if ( nNeededWidth <= aAreaParam.maClipRect.GetWidth() )
+ aAreaParam.mbLeftClip = aAreaParam.mbRightClip = FALSE;
// If the "###" replacement doesn't fit into the cells, no clip marks
// are shown, as the "###" already denotes too little space.
// The rectangles from the first GetOutputArea call remain valid.
}
- long nJustPosX = aAlignRect.Left(); // "justified" - effect of alignment will be added
- long nJustPosY = aAlignRect.Top();
- long nAvailWidth = aAlignRect.GetWidth();
- long nOutHeight = aAlignRect.GetHeight();
+ long nJustPosX = aAreaParam.maAlignRect.Left(); // "justified" - effect of alignment will be added
+ long nJustPosY = aAreaParam.maAlignRect.Top();
+ long nAvailWidth = aAreaParam.maAlignRect.GetWidth();
+ long nOutHeight = aAreaParam.maAlignRect.GetHeight();
- BOOL bOutside = ( aClipRect.Right() < nScrX || aClipRect.Left() >= nScrX + nScrW );
- if ( aClipRect.Left() < nScrX )
+ BOOL bOutside = ( aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrW );
+ if ( aAreaParam.maClipRect.Left() < nScrX )
{
- aClipRect.Left() = nScrX;
- bLeftClip = TRUE;
+ aAreaParam.maClipRect.Left() = nScrX;
+ aAreaParam.mbLeftClip = TRUE;
}
- if ( aClipRect.Right() > nScrX + nScrW )
+ if ( aAreaParam.maClipRect.Right() > nScrX + nScrW )
{
- aClipRect.Right() = nScrX + nScrW; //! minus one?
- bRightClip = TRUE;
+ aAreaParam.maClipRect.Right() = nScrX + nScrW; //! minus one?
+ aAreaParam.mbRightClip = TRUE;
}
- BOOL bHClip = bLeftClip || bRightClip;
+ BOOL bHClip = aAreaParam.mbLeftClip || aAreaParam.mbRightClip;
BOOL bVClip = FALSE;
- if ( aClipRect.Top() < nScrY )
+ if ( aAreaParam.maClipRect.Top() < nScrY )
{
- aClipRect.Top() = nScrY;
+ aAreaParam.maClipRect.Top() = nScrY;
bVClip = TRUE;
}
- if ( aClipRect.Bottom() > nScrY + nScrH )
+ if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrH )
{
- aClipRect.Bottom() = nScrY + nScrH; //! minus one?
+ aAreaParam.maClipRect.Bottom() = nScrY + nScrH; //! minus one?
bVClip = TRUE;
}
@@ -1603,27 +1771,27 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
if (!bHClip)
{
- aClipRect.Left() = nScrX;
- aClipRect.Right() = nScrX+nScrW;
+ aAreaParam.maClipRect.Left() = nScrX;
+ aAreaParam.maClipRect.Right() = nScrX+nScrW;
}
if (!bVClip)
{
- aClipRect.Top() = nScrY;
- aClipRect.Bottom() = nScrY+nScrH;
+ aAreaParam.maClipRect.Top() = nScrY;
+ aAreaParam.maClipRect.Bottom() = nScrY+nScrH;
}
// aClipRect is not used after SetClipRegion/IntersectClipRegion,
// so it can be modified here
if (bPixelToLogic)
- aClipRect = pRefDevice->PixelToLogic( aClipRect );
+ aAreaParam.maClipRect = pRefDevice->PixelToLogic( aAreaParam.maClipRect );
if (bMetaFile)
{
pDev->Push();
- pDev->IntersectClipRegion( aClipRect );
+ pDev->IntersectClipRegion( aAreaParam.maClipRect );
}
else
- pDev->SetClipRegion( Region( aClipRect ) );
+ pDev->SetClipRegion( Region( aAreaParam.maClipRect ) );
}
Point aURLStart( nJustPosX, nJustPosY ); // copy before modifying for orientation
@@ -1827,7 +1995,7 @@ long lcl_GetEditSize( EditEngine& rEngine, BOOL bWidth, BOOL bSwap, long nAttrRo
void ScOutputData::ShrinkEditEngine( EditEngine& rEngine, const Rectangle& rAlignRect,
long nLeftM, long nTopM, long nRightM, long nBottomM,
BOOL bWidth, USHORT nOrient, long nAttrRotate, BOOL bPixelToLogic,
- long& rEngineWidth, long& rEngineHeight, long& rNeededPixel, BOOL& rLeftClip, BOOL& rRightClip )
+ long& rEngineWidth, long& rEngineHeight, long& rNeededPixel, bool& rLeftClip, bool& rRightClip )
{
if ( !bWidth )
{
@@ -2149,10 +2317,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
nPosY = nScrY;
}
- Rectangle aAlignRect;
- Rectangle aClipRect;
- BOOL bLeftClip = FALSE;
- BOOL bRightClip = FALSE;
+ OutputAreaParam aAreaParam;
//
// Initial page size - large for normal text, cell size for automatic line breaks
@@ -2167,27 +2332,39 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
//! handle nArrY == 0
GetOutputArea( nXForPos, nArrYForPos, nPosX, nPosY, nCellX, nCellY, 0,
- *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
- bCellIsValue, TRUE, FALSE,
- aAlignRect, aClipRect, bLeftClip, bRightClip );
+ *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
+ bCellIsValue, true, false, aAreaParam );
//! special ScEditUtil handling if formatting for printer
if ( eOrient == SVX_ORIENTATION_TOPBOTTOM || eOrient == SVX_ORIENTATION_BOTTOMTOP )
- aPaperSize.Width() = aAlignRect.GetHeight() - nTopM - nBottomM;
+ aPaperSize.Width() = aAreaParam.maAlignRect.GetHeight() - nTopM - nBottomM;
else
- aPaperSize.Width() = aAlignRect.GetWidth() - nLeftM - nRightM;
+ aPaperSize.Width() = aAreaParam.maAlignRect.GetWidth() - nLeftM - nRightM;
if (bAsianVertical && bBreak)
{
// add some extra height (default margin value) for safety
// as long as GetEditArea isn't used below
long nExtraHeight = (long)( 20 * nPPTY );
- aPaperSize.Height() = aAlignRect.GetHeight() - nTopM - nBottomM + nExtraHeight;
+ aPaperSize.Height() = aAreaParam.maAlignRect.GetHeight() - nTopM - nBottomM + nExtraHeight;
}
}
if (bPixelToLogic)
- pEngine->SetPaperSize(pRefDevice->PixelToLogic(aPaperSize));
+ {
+ Size aLogicSize = pRefDevice->PixelToLogic(aPaperSize);
+ if ( bBreak && !bAsianVertical && pRefDevice != pFmtDevice )
+ {
+ // #i85342# screen display and formatting for printer,
+ // use same GetEditArea call as in ScViewData::SetEditEngine
+
+ Fraction aFract(1,1);
+ Rectangle aUtilRect = ScEditUtil( pDoc, nCellX, nCellY, nTab, Point(0,0), pFmtDevice,
+ HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( pPattern, FALSE );
+ aLogicSize.Width() = aUtilRect.GetWidth();
+ }
+ pEngine->SetPaperSize(aLogicSize);
+ }
else
pEngine->SetPaperSize(aPaperSize);
@@ -2372,26 +2549,26 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
{
// for break, the first GetOutputArea call is sufficient
GetOutputArea( nXForPos, nArrYForPos, nPosX, nPosY, nCellX, nCellY, nNeededPixel,
- *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
- bCellIsValue || bRepeat || bShrink, FALSE, FALSE,
- aAlignRect, aClipRect, bLeftClip, bRightClip );
+ *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
+ bCellIsValue || bRepeat || bShrink, false, false, aAreaParam );
if ( bShrink )
{
BOOL bWidth = ( eOrient == SVX_ORIENTATION_STANDARD && !bAsianVertical );
- ShrinkEditEngine( *pEngine, aAlignRect,
+ ShrinkEditEngine( *pEngine, aAreaParam.maAlignRect,
nLeftM, nTopM, nRightM, nBottomM, bWidth,
sal::static_int_cast<USHORT>(eOrient), 0, bPixelToLogic,
- nEngineWidth, nEngineHeight, nNeededPixel, bLeftClip, bRightClip );
+ nEngineWidth, nEngineHeight, nNeededPixel,
+ aAreaParam.mbLeftClip, aAreaParam.mbRightClip );
}
- if ( bRepeat && !bLeftClip && !bRightClip && pEngine->GetParagraphCount() == 1 )
+ if ( bRepeat && !aAreaParam.mbLeftClip && !aAreaParam.mbRightClip && pEngine->GetParagraphCount() == 1 )
{
// First check if twice the space for the formatted text is available
// (otherwise just keep it unchanged).
long nFormatted = nNeededPixel - nLeftM - nRightM; // without margin
- long nAvailable = aAlignRect.GetWidth() - nLeftM - nRightM;
+ long nAvailable = aAreaParam.maAlignRect.GetWidth() - nLeftM - nRightM;
if ( nAvailable >= 2 * nFormatted )
{
// "repeat" is handled with unformatted text (for performance reasons)
@@ -2425,7 +2602,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
}
}
- if ( bCellIsValue && ( bLeftClip || bRightClip ) )
+ if ( bCellIsValue && ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip ) )
{
pEngine->SetText( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("###")) );
nEngineWidth = (long) pEngine->CalcTextWidth();
@@ -2448,11 +2625,11 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
}
}
- long nStartX = aAlignRect.Left();
- long nStartY = aAlignRect.Top();
- long nCellWidth = aAlignRect.GetWidth();
+ long nStartX = aAreaParam.maAlignRect.Left();
+ long nStartY = aAreaParam.maAlignRect.Top();
+ long nCellWidth = aAreaParam.maAlignRect.GetWidth();
long nOutWidth = nCellWidth - 1 - nLeftM - nRightM;
- long nOutHeight = aAlignRect.GetHeight() - nTopM - nBottomM;
+ long nOutHeight = aAreaParam.maAlignRect.GetHeight() - nTopM - nBottomM;
if ( bBreak || eOrient != SVX_ORIENTATION_STANDARD || bAsianVertical )
{
@@ -2472,21 +2649,21 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
nStartX += nLeftM;
}
- BOOL bOutside = ( aClipRect.Right() < nScrX || aClipRect.Left() >= nScrX + nScrW );
- if ( aClipRect.Left() < nScrX )
+ BOOL bOutside = ( aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrW );
+ if ( aAreaParam.maClipRect.Left() < nScrX )
{
- aClipRect.Left() = nScrX;
- bLeftClip = TRUE;
+ aAreaParam.maClipRect.Left() = nScrX;
+ aAreaParam.mbLeftClip = true;
}
- if ( aClipRect.Right() > nScrX + nScrW )
+ if ( aAreaParam.maClipRect.Right() > nScrX + nScrW )
{
- aClipRect.Right() = nScrX + nScrW; //! minus one?
- bRightClip = TRUE;
+ aAreaParam.maClipRect.Right() = nScrX + nScrW; //! minus one?
+ aAreaParam.mbRightClip = true;
}
if ( !bHidden && !bOutside )
{
- BOOL bClip = bLeftClip || bRightClip;
+ bool bClip = aAreaParam.mbLeftClip || aAreaParam.mbRightClip;
BOOL bSimClip = FALSE;
if ( bWrapFields )
@@ -2495,14 +2672,14 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
bClip = TRUE;
}
- if ( aClipRect.Top() < nScrY )
+ if ( aAreaParam.maClipRect.Top() < nScrY )
{
- aClipRect.Top() = nScrY;
+ aAreaParam.maClipRect.Top() = nScrY;
bClip = TRUE;
}
- if ( aClipRect.Bottom() > nScrY + nScrH )
+ if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrH )
{
- aClipRect.Bottom() = nScrY + nScrH; //! minus one?
+ aAreaParam.maClipRect.Bottom() = nScrY + nScrH; //! minus one?
bClip = TRUE;
}
@@ -2554,8 +2731,8 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
bAnyClipped = TRUE;
long nMarkPixel = (long)( SC_CLIPMARK_SIZE * nPPTX );
- if ( aClipRect.Right() - nMarkPixel > aClipRect.Left() )
- aClipRect.Right() -= nMarkPixel;
+ if ( aAreaParam.maClipRect.Right() - nMarkPixel > aAreaParam.maClipRect.Left() )
+ aAreaParam.maClipRect.Right() -= nMarkPixel;
}
}
@@ -2579,9 +2756,9 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
// Clip marks are already handled in GetOutputArea
if (bPixelToLogic)
- aLogicClip = pRefDevice->PixelToLogic( aClipRect );
+ aLogicClip = pRefDevice->PixelToLogic( aAreaParam.maClipRect );
else
- aLogicClip = aClipRect;
+ aLogicClip = aAreaParam.maClipRect;
if (bClip) // bei bSimClip nur aClipRect initialisieren
{
@@ -3215,10 +3392,7 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
// use GetOutputArea to hide the grid
// (clip region is done manually below)
- BOOL bLeftClip = FALSE;
- BOOL bRightClip = FALSE;
- Rectangle aAlignRect;
- Rectangle aClipRect;
+ OutputAreaParam aAreaParam;
SCCOL nCellX = nX;
SCROW nCellY = nY;
@@ -3231,8 +3405,7 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
GetOutputArea( nX, nArrY, nCellStartX, nPosY, nCellX, nCellY, nNeededWidth,
*pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
- FALSE, FALSE, TRUE,
- aAlignRect, aClipRect, bLeftClip, bRightClip );
+ FALSE, FALSE, TRUE, aAreaParam );
if ( bShrink )
{
@@ -3240,19 +3413,19 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
pRefDevice->LogicToPixel(Size(nEngineWidth,0)).Width() : nEngineWidth;
long nNeededPixel = nPixelWidth + nLeftM + nRightM;
- bLeftClip = bRightClip = TRUE;
+ aAreaParam.mbLeftClip = aAreaParam.mbRightClip = TRUE;
// always do height
- ShrinkEditEngine( *pEngine, aAlignRect, nLeftM, nTopM, nRightM, nBottomM,
+ ShrinkEditEngine( *pEngine, aAreaParam.maAlignRect, nLeftM, nTopM, nRightM, nBottomM,
FALSE, sal::static_int_cast<USHORT>(eOrient), nAttrRotate, bPixelToLogic,
- nEngineWidth, nEngineHeight, nNeededPixel, bLeftClip, bRightClip );
+ nEngineWidth, nEngineHeight, nNeededPixel, aAreaParam.mbLeftClip, aAreaParam.mbRightClip );
if ( eRotMode == SVX_ROTATE_MODE_STANDARD )
{
// do width only if rotating within the cell (standard mode)
- ShrinkEditEngine( *pEngine, aAlignRect, nLeftM, nTopM, nRightM, nBottomM,
+ ShrinkEditEngine( *pEngine, aAreaParam.maAlignRect, nLeftM, nTopM, nRightM, nBottomM,
TRUE, sal::static_int_cast<USHORT>(eOrient), nAttrRotate, bPixelToLogic,
- nEngineWidth, nEngineHeight, nNeededPixel, bLeftClip, bRightClip );
+ nEngineWidth, nEngineHeight, nNeededPixel, aAreaParam.mbLeftClip, aAreaParam.mbRightClip );
}
// nEngineWidth/nEngineHeight is updated in ShrinkEditEngine
@@ -3306,19 +3479,19 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
}
if (bPixelToLogic)
- aClipRect = pRefDevice->PixelToLogic( Rectangle(
+ aAreaParam.maClipRect = pRefDevice->PixelToLogic( Rectangle(
Point(nClipStartX,nClipStartY), aClipSize ) );
else
- aClipRect = Rectangle(Point(nClipStartX, nClipStartY),
+ aAreaParam.maClipRect = Rectangle(Point(nClipStartX, nClipStartY),
aClipSize ); // Scale = 1
if (bMetaFile)
{
pDev->Push();
- pDev->IntersectClipRegion( aClipRect );
+ pDev->IntersectClipRegion( aAreaParam.maClipRect );
}
else
- pDev->SetClipRegion( Region( aClipRect ) );
+ pDev->SetClipRegion( Region( aAreaParam.maClipRect ) );
}
Point aLogicStart;