[Libreoffice-commits] .: 9 commits - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed Sep 7 08:14:44 PDT 2011
sc/source/ui/app/inputwin.cxx | 554 ++++++++++++++++++++++++++----------------
sc/source/ui/inc/inputwin.hxx | 20 +
2 files changed, 371 insertions(+), 203 deletions(-)
New commits:
commit ffe828263462188f0af76eb101935ff0feb395dd
Merge: 1b7c610... 81ad165...
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Wed Sep 7 11:14:33 2011 -0400
Merge branch 'master' into feature/calc-multiline-input
commit 1b7c610534f97bc00291c1bacc39963d88931933
Merge: 0bf7045... aa059de...
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Wed Sep 7 11:01:53 2011 -0400
Merge branch 'master' into feature/calc-multiline-input
commit 0bf70454ae4d1b23d8eab63f85e12f0d24e0857b
Author: Anurag Jain <anuragjainfzd at gmail.com>
Date: Tue Aug 23 20:19:39 2011 +0530
Fixed premature wrapping, black spot in A1 and scrollbar and button position.
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index bff10cb..9c1879f 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -835,8 +835,8 @@ void ScInputBarGroup::Resize()
}
SetSizePixel(aSize);
- aButton.SetPosPixel(Point(aSize.Width()-4*LEFT_OFFSET,0));
- aScrollBar.SetPosPixel(Point(aSize.Width()-2*LEFT_OFFSET,0));
+ aScrollBar.SetPosPixel(Point(aSize.Width()-4*LEFT_OFFSET,0));
+ aButton.SetPosPixel(Point(aSize.Width()-2*LEFT_OFFSET,0));
Invalidate();
aMultiTextWnd.Resize();
@@ -902,7 +902,7 @@ IMPL_LINK( ScInputBarGroup, ClickHdl, PushButton*, pBtn )
pParent->SetMultiLineStatus(false);
}
pParent->Resize();
- pParent->CalcWindowSizePixel(); // TODO: changed from RecalcItems(). check if this does the same thing.
+ //pParent->CalcWindowSizePixel(); // TODO: changed from RecalcItems(). check if this does the same thing.
return 0;
}
@@ -934,8 +934,8 @@ void ScMultiTextWnd::Paint( const Rectangle& rRec )
{
// We always use edit engine to draw text at all times.
if (!pEditEngine)
- //InitEditEngine(SfxObjectShell::Current());
- StartEditEngine();
+ InitEditEngine(SfxObjectShell::Current());
+ //StartEditEngine();
if (pEditView)
{
@@ -979,6 +979,8 @@ void ScMultiTextWnd::Resize()
pEditView->SetOutputArea(
PixelToLogic(Rectangle(aPos1, aPos2)));
+ pEditEngine->SetPaperSize( PixelToLogic(Size(aOutputSize.Width() - 2*LEFT_OFFSET, 10000 ) ));
+
}
}
@@ -998,6 +1000,8 @@ void ScMultiTextWnd::Resize()
pEditView->SetOutputArea(
PixelToLogic(Rectangle(aPos1, aPos2)));
+
+ pEditEngine->SetPaperSize( PixelToLogic(Size(aOutputSize.Width() - 2*LEFT_OFFSET, 10000 ) ));
}
}
SetSizePixel(aTextBoxSize);
@@ -1084,9 +1088,9 @@ void ScMultiTextWnd::InitEditEngine(SfxObjectShell* pObjSh)
Size barSize=GetSizePixel();
barSize.Width() -= (2*nTextStartPos-4);
- printf("bar size width %ld",barSize.Width());
+ printf("bar size width %ld\n",barSize.Width());
pEditEngine->SetUpdateMode( false );
- pEditEngine->SetPaperSize( PixelToLogic(Size(994-4*LEFT_OFFSET,10000)) );
+ pEditEngine->SetPaperSize( PixelToLogic(Size(barSize.Width(),10000)) );
pEditEngine->SetWordDelimiters(
ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) );
commit 7ac4779c1770ba0bc7982d4ef47253c4b32650b1
Author: Anurag Jain <anuragjainfzd at gmail.com>
Date: Sat Aug 20 23:09:40 2011 +0530
Made Scrollbar to appear and resize improved.
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 3130d54..bff10cb 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -512,10 +512,10 @@ void ScInputWindow::Resize()
}
else
{
- aSize.Height()=33;
+ aSize.Height()=38;
}
SetSizePixel(aSize);
- //Invalidate();
+ Invalidate();
aTextWindow.Resize();
}
else
@@ -759,15 +759,24 @@ void ScInputWindow::SetMultiLineStatus(bool bMode)
ScInputBarGroup::ScInputBarGroup(Window* pParent)
: ScTextWndBase ( pParent, WinBits(WB_HIDE) ),
aMultiTextWnd ( this ),
- aButton ( this)
+ aButton ( this ),
+ aScrollBar ( this, WB_VERT )
{
aMultiTextWnd.Show();
aMultiTextWnd.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) );
aMultiTextWnd.SetHelpId ( HID_INSWIN_INPUT );
aButton.SetClickHdl ( LINK( this, ScInputBarGroup, ClickHdl ) );
- aButton.Show();
+ aButton.SetSizePixel(Size(0.5*TBX_WINDOW_HEIGHT,TBX_WINDOW_HEIGHT));
aButton.Enable();
+ aButton.Show();
+
+ aScrollBar.SetSizePixel( Size(0.5*TBX_WINDOW_HEIGHT,TBX_WINDOW_HEIGHT) );
+
+ aScrollBar.SetPageSize( 1 );
+ aScrollBar.SetVisibleSize( 1 );
+ aScrollBar.SetLineSize( 1 );
+ aScrollBar.Show();
}
ScInputBarGroup::~ScInputBarGroup()
@@ -811,9 +820,10 @@ void ScInputBarGroup::Resize()
}
long nWidth = pParent->GetSizePixel().Width();
- Point aPos = GetPosPixel();
+ long nLeft = GetPosPixel().X();
+
Size aSize = GetSizePixel();
- aSize.Width() = Max( ((long)(nWidth - aPos.X() - LEFT_OFFSET)), (long)0 );
+ aSize.Width() = Max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 );
if(pParent->GetMultiLineStatus())
{
@@ -823,11 +833,12 @@ void ScInputBarGroup::Resize()
{
aSize.Height()=TBX_WINDOW_HEIGHT;
}
- SetPosSizePixel(aPos,aSize);
- Invalidate();
+ SetSizePixel(aSize);
- aButton.SetPosSizePixel(Point(aSize.Width()-3*LEFT_OFFSET,0),Size(0.5*TBX_WINDOW_HEIGHT,TBX_WINDOW_HEIGHT));
+ aButton.SetPosPixel(Point(aSize.Width()-4*LEFT_OFFSET,0));
+ aScrollBar.SetPosPixel(Point(aSize.Width()-2*LEFT_OFFSET,0));
+ Invalidate();
aMultiTextWnd.Resize();
}
@@ -895,6 +906,12 @@ IMPL_LINK( ScInputBarGroup, ClickHdl, PushButton*, pBtn )
return 0;
}
+IMPL_LINK( ScInputBarGroup, Impl_ScrollHdl, ScrollBar*, EMPTYARG )
+{
+
+}
+
+
//========================================================================
// ScMultiTextWnd
//========================================================================
@@ -917,7 +934,8 @@ void ScMultiTextWnd::Paint( const Rectangle& rRec )
{
// We always use edit engine to draw text at all times.
if (!pEditEngine)
- InitEditEngine(SfxObjectShell::Current());
+ //InitEditEngine(SfxObjectShell::Current());
+ StartEditEngine();
if (pEditView)
{
@@ -939,9 +957,10 @@ void ScMultiTextWnd::Resize()
long nWidth = GetParent()->GetSizePixel().Width();
- Point aPos=GetPosPixel();
+ long nLeft = GetPosPixel().X();
+
Size aTextBoxSize = GetSizePixel();
- aTextBoxSize.Width() = Max( ((long)(nWidth - aPos.X() - 3*LEFT_OFFSET)), (long)0 );
+ aTextBoxSize.Width() = Max( ((long)(nWidth - nLeft - 4*LEFT_OFFSET)), (long)0 );
if(pParent->GetMultiLineStatus())
{
@@ -966,7 +985,6 @@ void ScMultiTextWnd::Resize()
else
{
-
aTextBoxSize.Height()=TBX_WINDOW_HEIGHT;
if(pEditView)
{
@@ -977,17 +995,14 @@ void ScMultiTextWnd::Resize()
Point aPos1(TEXT_STARTPOS,nDiff);
Point aPos2(aOutputSize.Width()-5,(aOutputSize.Height() - nDiff));
+
pEditView->SetOutputArea(
PixelToLogic(Rectangle(aPos1, aPos2)));
}
-
}
-
- SetPosSizePixel(aPos,aTextBoxSize);
+ SetSizePixel(aTextBoxSize);
}
-
-
void ScMultiTextWnd::StartEditEngine()
{
// Bei "eigener Modalitaet" (Doc-modale Dialoge) nicht aktivieren
@@ -1067,16 +1082,11 @@ void ScMultiTextWnd::InitEditEngine(SfxObjectShell* pObjSh)
pNew->SetExecuteURL( false );
pEditEngine = pNew;
- Size barSize=GetOutputSizePixel();
-
- long barHeight=barSize.Height();
- long textHeight=LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
- long nDiff = barHeight - textHeight;
-
- barSize.Height()=nDiff+barHeight;
- barSize.Width() -= 2*nTextStartPos-4;
+ Size barSize=GetSizePixel();
+ barSize.Width() -= (2*nTextStartPos-4);
+ printf("bar size width %ld",barSize.Width());
pEditEngine->SetUpdateMode( false );
- pEditEngine->SetPaperSize( PixelToLogic(Size(barSize.Width(),10000)) );
+ pEditEngine->SetPaperSize( PixelToLogic(Size(994-4*LEFT_OFFSET,10000)) );
pEditEngine->SetWordDelimiters(
ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) );
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 98e6c2e..bf1217b 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -35,6 +35,7 @@
#include <svl/lstner.hxx>
#include <vcl/button.hxx>
#include <vcl/combobox.hxx>
+#include <vcl/scrbar.hxx>
#include <vcl/window.hxx>
#include <svtools/transfer.hxx>
@@ -209,9 +210,11 @@ private:
ScMultiTextWnd aMultiTextWnd;
PushButton aButton;
+ ScrollBar aScrollBar;
// bool bIsMultiLine;
DECL_LINK( ClickHdl, PushButton* );
+ DECL_LINK( Impl_ScrollHdl, ScrollBar* );
};
commit 1d202c7593fb0fa588755d4514cf77697054a16c
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Mon Aug 15 22:33:24 2011 -0400
Actually master doesn't have this bit.
diff --git a/sw/source/ui/vba/vbarows.cxx b/sw/source/ui/vba/vbarows.cxx
index 01c8dfd..7b1f939 100644
--- a/sw/source/ui/vba/vbarows.cxx
+++ b/sw/source/ui/vba/vbarows.cxx
@@ -263,10 +263,6 @@ void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent ) throw (uno::RuntimeE
sal_Int32 nWidth = 0;
xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
sal_Int32 nNewWidth = nWidth - indent;
- if ((nNewWidth <= 0) || (nWidth <= 0))
- {
- throw new RuntimeException("Pb with width, in SwVbaRows::setIndentWithAdjustProportional (nNewWidth <= 0) || (nWidth <= 0)");
- }
double propFactor = (double)nNewWidth/(double)nWidth;
// get all columns, calculate and set the new width of the columns
commit 0afb877d105a35b8c2c17ef819d26f4a6ab3d2d1
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Mon Aug 15 18:09:14 2011 -0400
Hmm, I didn't mean to check this one in either.
diff --git a/sw/source/ui/vba/vbarows.cxx b/sw/source/ui/vba/vbarows.cxx
index 7b1f939..01c8dfd 100644
--- a/sw/source/ui/vba/vbarows.cxx
+++ b/sw/source/ui/vba/vbarows.cxx
@@ -263,6 +263,10 @@ void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent ) throw (uno::RuntimeE
sal_Int32 nWidth = 0;
xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
sal_Int32 nNewWidth = nWidth - indent;
+ if ((nNewWidth <= 0) || (nWidth <= 0))
+ {
+ throw new RuntimeException("Pb with width, in SwVbaRows::setIndentWithAdjustProportional (nNewWidth <= 0) || (nWidth <= 0)");
+ }
double propFactor = (double)nNewWidth/(double)nWidth;
// get all columns, calculate and set the new width of the columns
commit df2fb17fd6520974f36fb422d7713f50fd710f6b
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Mon Aug 15 18:03:48 2011 -0400
I didn't mean to check this one in.
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 4d9bb10..dd482c6 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -398,7 +398,6 @@ public:
void CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId,
sal_uInt16 nNewPos = TOOLBOX_APPEND );
void Clear();
- void RecalcItems();
const ImageList& GetImageList() const { return maImageList; }
void SetImageList( const ImageList& rImageList );
commit a10f0b380d4b2ebf32c5acc446c491f17fbca449
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Mon Aug 15 17:57:35 2011 -0400
Fixed build breakage.
ToolBox::RecalcItem() is no more. Find out the replacement method
gets the job done.
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index b40742a..3130d54 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -77,6 +77,7 @@
#include "AccessibleEditObject.hxx"
#include "AccessibleText.hxx"
#include <svtools/miscopt.hxx>
+#include <comphelper/string.hxx>
#define TEXT_STARTPOS 3
#define TEXT_MULTI_STARTPOS 5
@@ -890,7 +891,7 @@ IMPL_LINK( ScInputBarGroup, ClickHdl, PushButton*, pBtn )
pParent->SetMultiLineStatus(false);
}
pParent->Resize();
- pParent->RecalcItems();
+ pParent->CalcWindowSizePixel(); // TODO: changed from RecalcItems(). check if this does the same thing.
return 0;
}
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index dd482c6..4d9bb10 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -398,6 +398,7 @@ public:
void CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId,
sal_uInt16 nNewPos = TOOLBOX_APPEND );
void Clear();
+ void RecalcItems();
const ImageList& GetImageList() const { return maImageList; }
void SetImageList( const ImageList& rImageList );
commit a5d17247175a68fdd42dc5f4a5212954b71815d7
Author: Anurag Jain <anuragjainfzd at gmail.com>
Date: Mon Aug 15 15:46:02 2011 -0400
Ported the chnage from the split calc repo.
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 401d68c..b40742a 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -51,6 +51,7 @@
#include <vcl/cursor.hxx>
#include <vcl/help.hxx>
#include <svl/stritem.hxx>
+#include <stdio.h>
#include "inputwin.hxx"
#include "scmod.hxx"
@@ -76,12 +77,12 @@
#include "AccessibleEditObject.hxx"
#include "AccessibleText.hxx"
#include <svtools/miscopt.hxx>
-#include <comphelper/string.hxx>
#define TEXT_STARTPOS 3
#define TEXT_MULTI_STARTPOS 5
#define THESIZE 1000000 //!!! langt... :-)
#define TBX_WINDOW_HEIGHT 22 // in Pixeln - fuer alle Systeme gleich?
+#define LEFT_OFFSET 5
enum ScNameInputType
{
@@ -160,7 +161,8 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) :
aTextCancel ( ScResId( SCSTR_QHELP_BTNCANCEL ) ),
aTextSum ( ScResId( SCSTR_QHELP_BTNSUM ) ),
aTextEqual ( ScResId( SCSTR_QHELP_BTNEQUAL ) ),
- bIsOkCancelMode ( false )
+ bIsOkCancelMode ( false ),
+ bIsMultiLine ( false )
{
ScModule* pScMod = SC_MOD();
SfxImageManager* pImgMgr = SfxImageManager::GetImageManager( pScMod );
@@ -177,7 +179,7 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) :
}
OSL_ENSURE( pViewSh, "no view shell for input window" );
- // Positionsfenster, 3 Buttons, Eingabefenster
+ // Position window, 3 buttons, input window
InsertWindow ( 1, &aWndPos, 0, 0 );
InsertSeparator ( 1 );
InsertItem ( SID_INPUT_FUNCTION, IMAGE( SID_INPUT_FUNCTION ), 0, 2 );
@@ -478,7 +480,7 @@ void ScInputWindow::Select()
aTextWindow.StartEditEngine();
if ( pScMod->IsEditMode() ) // nicht, wenn z.B. geschuetzt
{
- aTextWindow.GrabFocus();
+ aTextWindow.StartEditEngine();
aTextWindow.SetTextString( '=' );
EditView* pView = aTextWindow.GetEditView();
@@ -499,19 +501,33 @@ void ScInputWindow::Resize()
{
ToolBox::Resize();
- long nWidth = GetSizePixel().Width();
- long nLeft = aTextWindow.GetPosPixel().X();
- Size aSize = aTextWindow.GetSizePixel();
-
- aSize.Width() = Max( ((long)(nWidth - nLeft - 5)), (long)0 );
if ( lcl_isExperimentalMode() )
{
- aSize.Height()= TBX_WINDOW_HEIGHT;
- aTextWindow.SetSizePixel( aSize );
+ Size aSize = GetSizePixel();
+ //aTextWindow.SetSizePixel( aSize );
+ if( bIsMultiLine )
+ {
+ aSize.Height()=77;
+ }
+ else
+ {
+ aSize.Height()=33;
+ }
+ SetSizePixel(aSize);
+ //Invalidate();
aTextWindow.Resize();
}
- aTextWindow.SetSizePixel( aSize );
- aTextWindow.Invalidate();
+ else
+ {
+ long nWidth = GetSizePixel().Width();
+ long nLeft = aTextWindow.GetPosPixel().X();
+ Size aSize = aTextWindow.GetSizePixel();
+
+ aSize.Width() = Max( ((long)(nWidth - nLeft - 5)), (long)0 );
+
+ aTextWindow.SetSizePixel( aSize );
+ aTextWindow.Invalidate();
+ }
}
void ScInputWindow::SetFuncString( const String& rString, sal_Bool bDoEdit )
@@ -724,18 +740,33 @@ void ScInputWindow::DataChanged( const DataChangedEvent& rDCEvt )
ToolBox::DataChanged( rDCEvt );
}
+bool ScInputWindow::GetMultiLineStatus()
+{
+ return bIsMultiLine;
+}
+
+void ScInputWindow::SetMultiLineStatus(bool bMode)
+{
+ bIsMultiLine=bMode;
+}
+
+
//========================================================================
// ScInputBarGroup
//========================================================================
ScInputBarGroup::ScInputBarGroup(Window* pParent)
: ScTextWndBase ( pParent, WinBits(WB_HIDE) ),
- aTextWindow ( this ),
- bIsMultiLine ( false )
+ aMultiTextWnd ( this ),
+ aButton ( this)
{
- aTextWindow.Show();
- aTextWindow.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) );
- aTextWindow.SetHelpId ( HID_INSWIN_INPUT );
+ aMultiTextWnd.Show();
+ aMultiTextWnd.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) );
+ aMultiTextWnd.SetHelpId ( HID_INSWIN_INPUT );
+
+ aButton.SetClickHdl ( LINK( this, ScInputBarGroup, ClickHdl ) );
+ aButton.Show();
+ aButton.Enable();
}
ScInputBarGroup::~ScInputBarGroup()
@@ -746,80 +777,141 @@ ScInputBarGroup::~ScInputBarGroup()
void
ScInputBarGroup::InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData )
{
- aTextWindow.InsertAccessibleTextData( rTextData );
+ aMultiTextWnd.InsertAccessibleTextData( rTextData );
}
void
ScInputBarGroup::RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData )
{
- aTextWindow.RemoveAccessibleTextData( rTextData );
+ aMultiTextWnd.RemoveAccessibleTextData( rTextData );
}
const String&
ScInputBarGroup::GetTextString() const
{
- return aTextWindow.GetTextString();
+ return aMultiTextWnd.GetTextString();
}
void ScInputBarGroup::SetTextString( const String& rString )
{
- aTextWindow.SetTextString(rString);
+ aMultiTextWnd.SetTextString(rString);
}
void ScInputBarGroup::Resize()
{
- long nWidth = GetSizePixel().Width();
- long nLeft = aTextWindow.GetPosPixel().X();
- Size aSize = aTextWindow.GetSizePixel();
+ Window *w=GetParent();
+ ScInputWindow *pParent;
+ pParent=dynamic_cast<ScInputWindow*>(w);
- aSize.Width() = Max( ((long)(nWidth - nLeft - 40)), (long)0 );
- aSize.Height()=22;
- aTextWindow.SetSizePixel( aSize );
- aTextWindow.Invalidate();
+ if(pParent==NULL)
+ {
+ OSL_FAIL("The parent window pointer pParent is null");
+ return;
+ }
+
+ long nWidth = pParent->GetSizePixel().Width();
+ Point aPos = GetPosPixel();
+ Size aSize = GetSizePixel();
+ aSize.Width() = Max( ((long)(nWidth - aPos.X() - LEFT_OFFSET)), (long)0 );
+
+ if(pParent->GetMultiLineStatus())
+ {
+ aSize.Height()=3*TBX_WINDOW_HEIGHT;
+ }
+ else
+ {
+ aSize.Height()=TBX_WINDOW_HEIGHT;
+ }
+ SetPosSizePixel(aPos,aSize);
+ Invalidate();
+
+ aButton.SetPosSizePixel(Point(aSize.Width()-3*LEFT_OFFSET,0),Size(0.5*TBX_WINDOW_HEIGHT,TBX_WINDOW_HEIGHT));
+
+ aMultiTextWnd.Resize();
}
+
void ScInputBarGroup::GainFocus()
{
- aTextWindow.GrabFocus();
+ aMultiTextWnd.GrabFocus();
}
void ScInputBarGroup::StopEditEngine( sal_Bool bAll )
{
- aTextWindow.StopEditEngine( bAll );
+ aMultiTextWnd.StopEditEngine( bAll );
}
void ScInputBarGroup::StartEditEngine()
{
- aTextWindow.StartEditEngine();
+ aMultiTextWnd.StartEditEngine();
}
+
void ScInputBarGroup::MakeDialogEditView()
{
- aTextWindow.MakeDialogEditView();
+ aMultiTextWnd.MakeDialogEditView();
}
EditView* ScInputBarGroup::GetEditView()
{
- return aTextWindow.GetEditView();
+ return aMultiTextWnd.GetEditView();
}
sal_Bool ScInputBarGroup::IsInputActive()
{
- return aTextWindow.IsInputActive();
+ return aMultiTextWnd.IsInputActive();
}
void ScInputBarGroup::SetFormulaMode(sal_Bool bSet)
{
- aTextWindow.SetFormulaMode(bSet);
+ aMultiTextWnd.SetFormulaMode(bSet);
}
+IMPL_LINK( ScInputBarGroup, ClickHdl, PushButton*, pBtn )
+{
+ Window *w=GetParent();
+ ScInputWindow *pParent;
+ pParent=dynamic_cast<ScInputWindow*>(w);
+
+ if(pParent==NULL)
+ {
+ OSL_FAIL("The parent window pointer pParent is null");
+ return 1;
+ }
+
+ if(!pParent->GetMultiLineStatus())
+ {
+ pParent->SetMultiLineStatus(true);
+ }
+ else
+ {
+ pParent->SetMultiLineStatus(false);
+ }
+ pParent->Resize();
+ pParent->RecalcItems();
+ return 0;
+}
+
+//========================================================================
+// ScMultiTextWnd
+//========================================================================
+
ScMultiTextWnd::ScMultiTextWnd( Window* pParen ) : ScTextWnd( pParen )
{
nTextStartPos = TEXT_MULTI_STARTPOS;
}
+int ScMultiTextWnd::GetLineCount()
+{
+ if(pEditView)
+ {
+ return pEditEngine->GetLineCount(0);
+ }
+ return 1;
+}
+
void ScMultiTextWnd::Paint( const Rectangle& rRec )
{
// We always use edit engine to draw text at all times.
@@ -834,21 +926,225 @@ void ScMultiTextWnd::Paint( const Rectangle& rRec )
void ScMultiTextWnd::Resize()
{
- if (pEditView)
+ Window *w=GetParent()->GetParent();
+ ScInputWindow *pParent;
+ pParent=dynamic_cast<ScInputWindow*>(w);
+
+ if(pParent==NULL)
{
- Size aSize = GetOutputSizePixel();
+ OSL_FAIL("The parent window pointer pParent is null");
+ return;
+ }
+
+
+ long nWidth = GetParent()->GetSizePixel().Width();
+ Point aPos=GetPosPixel();
+ Size aTextBoxSize = GetSizePixel();
+ aTextBoxSize.Width() = Max( ((long)(nWidth - aPos.X() - 3*LEFT_OFFSET)), (long)0 );
+
+ if(pParent->GetMultiLineStatus())
+ {
+ aTextBoxSize.Height()=3*LogicToPixel(Size(0,GetTextHeight())).Height()+8;
+
+ if(pEditView)
+ {
+ Size aOutputSize=GetOutputSizePixel();
+ Size aLineSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0)));
+
+ int nDiff = (aOutputSize.Height() - 3*aLineSize.Height())/2;
+
+ Point aPos1(TEXT_STARTPOS,nDiff);
+ Point aPos2(aOutputSize.Width()-5,aOutputSize.Height()-2);
+
+ pEditView->SetOutputArea(
+ PixelToLogic(Rectangle(aPos1, aPos2)));
+
+ }
- Size bSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0)));
- int nDiff=(aSize.Height()-bSize.Height())/2;
- Point aPos(nTextStartPos,nDiff*aSize.Height()/aSize.Height());
- Point aPos2(aSize.Width()-5,(aSize.Height()-nDiff)*aSize.Height()/aSize.Height());
- pEditView->SetOutputArea(
- PixelToLogic(Rectangle(aPos, aPos2)));
}
+
+ else
+ {
+
+ aTextBoxSize.Height()=TBX_WINDOW_HEIGHT;
+ if(pEditView)
+ {
+ Size aOutputSize=GetOutputSizePixel();
+ Size aLineSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0)));
+
+ int nDiff = (aOutputSize.Height() - aLineSize.Height())/2;
+
+ Point aPos1(TEXT_STARTPOS,nDiff);
+ Point aPos2(aOutputSize.Width()-5,(aOutputSize.Height() - nDiff));
+ pEditView->SetOutputArea(
+ PixelToLogic(Rectangle(aPos1, aPos2)));
+ }
+
+ }
+
+ SetPosSizePixel(aPos,aTextBoxSize);
+}
+
+
+
+void ScMultiTextWnd::StartEditEngine()
+{
+ // Bei "eigener Modalitaet" (Doc-modale Dialoge) nicht aktivieren
+
+ SfxObjectShell* pObjSh = SfxObjectShell::Current();
+ if ( pObjSh && pObjSh->IsInModalMode() )
+ return;
+
+ if ( !pEditView || !pEditEngine )
+ {
+ InitEditEngine(pObjSh);
+ }
+
+ SC_MOD()->SetInputMode( SC_INPUT_TOP );
+
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if (pViewFrm)
+ pViewFrm->GetBindings().Invalidate( SID_ATTR_INSERT );
+}
+
+void lcl_ExtendEditFontAttribs( SfxItemSet& rSet )
+{
+ const SfxPoolItem& rFontItem = rSet.Get( EE_CHAR_FONTINFO );
+ rSet.Put( rFontItem, EE_CHAR_FONTINFO_CJK );
+ rSet.Put( rFontItem, EE_CHAR_FONTINFO_CTL );
+ const SfxPoolItem& rHeightItem = rSet.Get( EE_CHAR_FONTHEIGHT );
+ rSet.Put( rHeightItem, EE_CHAR_FONTHEIGHT_CJK );
+ rSet.Put( rHeightItem, EE_CHAR_FONTHEIGHT_CTL );
+ const SfxPoolItem& rWeightItem = rSet.Get( EE_CHAR_WEIGHT );
+ rSet.Put( rWeightItem, EE_CHAR_WEIGHT_CJK );
+ rSet.Put( rWeightItem, EE_CHAR_WEIGHT_CTL );
+ const SfxPoolItem& rItalicItem = rSet.Get( EE_CHAR_ITALIC );
+ rSet.Put( rItalicItem, EE_CHAR_ITALIC_CJK );
+ rSet.Put( rItalicItem, EE_CHAR_ITALIC_CTL );
+ const SfxPoolItem& rLangItem = rSet.Get( EE_CHAR_LANGUAGE );
+ rSet.Put( rLangItem, EE_CHAR_LANGUAGE_CJK );
+ rSet.Put( rLangItem, EE_CHAR_LANGUAGE_CTL );
+}
+
+void lcl_ModifyRTLDefaults( SfxItemSet& rSet )
+{
+ rSet.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
+
+ // always using rtl writing direction would break formulas
+ //rSet.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
+
+ // PaperSize width is limited to USHRT_MAX in RTL mode (because of EditEngine's
+ // sal_uInt16 values in EditLine), so the text may be wrapped and line spacing must be
+ // increased to not see the beginning of the next line.
+ SvxLineSpacingItem aItem( SVX_LINESPACE_TWO_LINES, EE_PARA_SBL );
+ aItem.SetPropLineSpace( 200 );
+ rSet.Put( aItem );
+}
+
+void lcl_ModifyRTLVisArea( EditView* pEditView )
+{
+ Rectangle aVisArea = pEditView->GetVisArea();
+ Size aPaper = pEditView->GetEditEngine()->GetPaperSize();
+ long nDiff = aPaper.Width() - aVisArea.Right();
+ aVisArea.Left() += nDiff;
+ aVisArea.Right() += nDiff;
+ pEditView->SetVisArea(aVisArea);
+}
+
+
+void ScMultiTextWnd::InitEditEngine(SfxObjectShell* pObjSh)
+{
+ ScFieldEditEngine* pNew;
+ ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
+ if ( pViewSh )
+ {
+ const ScDocument* pDoc = pViewSh->GetViewData()->GetDocument();
+ pNew = new ScFieldEditEngine( pDoc->GetEnginePool(), pDoc->GetEditPool() );
+ }
+ else
+ pNew = new ScFieldEditEngine( EditEngine::CreatePool(), NULL, sal_True );
+ pNew->SetExecuteURL( false );
+ pEditEngine = pNew;
+
+ Size barSize=GetOutputSizePixel();
+
+ long barHeight=barSize.Height();
+ long textHeight=LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
+ long nDiff = barHeight - textHeight;
+
+ barSize.Height()=nDiff+barHeight;
+ barSize.Width() -= 2*nTextStartPos-4;
+ pEditEngine->SetUpdateMode( false );
+ pEditEngine->SetPaperSize( PixelToLogic(Size(barSize.Width(),10000)) );
+ pEditEngine->SetWordDelimiters(
+ ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) );
+
+ UpdateAutoCorrFlag();
+
+ {
+ SfxItemSet* pSet = new SfxItemSet( pEditEngine->GetEmptyItemSet() );
+ pEditEngine->SetFontInfoInItemSet( *pSet, aTextFont );
+ lcl_ExtendEditFontAttribs( *pSet );
+ // turn off script spacing to match DrawText output
+ pSet->Put( SvxScriptSpaceItem( false, EE_PARA_ASIANCJKSPACING ) );
+ if ( bIsRTL )
+ lcl_ModifyRTLDefaults( *pSet );
+ pEditEngine->SetDefaults( pSet );
+ }
+
+ // Wenn in der Zelle URL-Felder enthalten sind, muessen die auch in
+ // die Eingabezeile uebernommen werden, weil sonst die Positionen nicht stimmen.
+
+ sal_Bool bFilled = false;
+ ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
+ if ( pHdl ) //! Testen, ob's der richtige InputHdl ist?
+ bFilled = pHdl->GetTextAndFields( *pEditEngine );
+
+ pEditEngine->SetUpdateMode( sal_True );
+
+ // aString ist die Wahrheit...
+ if ( bFilled && pEditEngine->GetText() == aString )
+ Invalidate(); // Repaint fuer (hinterlegte) Felder
+ else
+ pEditEngine->SetText(aString); // dann wenigstens den richtigen Text
+
+ pEditView = new EditView( pEditEngine, this );
+ pEditView->SetInsertMode(bIsInsertMode);
+
+ // Text aus Clipboard wird als ASCII einzeilig uebernommen
+ sal_uLong n = pEditView->GetControlWord();
+ pEditView->SetControlWord( n | EV_CNTRL_SINGLELINEPASTE );
+
+ pEditEngine->InsertView( pEditView, EE_APPEND );
+
+ Resize();
+
+ if ( bIsRTL )
+ lcl_ModifyRTLVisArea( pEditView );
+
+ pEditEngine->SetModifyHdl(LINK(this, ScTextWnd, NotifyHdl));
+
+ if (!maAccTextDatas.empty())
+ maAccTextDatas.back()->StartEdit();
+
+ // as long as EditEngine and DrawText sometimes differ for CTL text,
+ // repaint now to have the EditEngine's version visible
+// SfxObjectShell* pObjSh = SfxObjectShell::Current();
+ if ( pObjSh && pObjSh->ISA(ScDocShell) )
+ {
+ ScDocument* pDoc = ((ScDocShell*)pObjSh)->GetDocument(); // any document
+ sal_uInt8 nScript = pDoc->GetStringScriptType( aString );
+ if ( nScript & SCRIPTTYPE_COMPLEX )
+ Invalidate();
+ }
+}
+
+void ScMultiTextWnd::StopEditEngine( sal_Bool /*bAll*/ )
+{
}
//========================================================================
-// Eingabefenster
+// ScTextWnd
//========================================================================
ScTextWnd::ScTextWnd( Window* pParent )
@@ -1115,161 +1411,6 @@ void ScTextWnd::UpdateAutoCorrFlag()
}
}
-void lcl_ExtendEditFontAttribs( SfxItemSet& rSet )
-{
- const SfxPoolItem& rFontItem = rSet.Get( EE_CHAR_FONTINFO );
- rSet.Put( rFontItem, EE_CHAR_FONTINFO_CJK );
- rSet.Put( rFontItem, EE_CHAR_FONTINFO_CTL );
- const SfxPoolItem& rHeightItem = rSet.Get( EE_CHAR_FONTHEIGHT );
- rSet.Put( rHeightItem, EE_CHAR_FONTHEIGHT_CJK );
- rSet.Put( rHeightItem, EE_CHAR_FONTHEIGHT_CTL );
- const SfxPoolItem& rWeightItem = rSet.Get( EE_CHAR_WEIGHT );
- rSet.Put( rWeightItem, EE_CHAR_WEIGHT_CJK );
- rSet.Put( rWeightItem, EE_CHAR_WEIGHT_CTL );
- const SfxPoolItem& rItalicItem = rSet.Get( EE_CHAR_ITALIC );
- rSet.Put( rItalicItem, EE_CHAR_ITALIC_CJK );
- rSet.Put( rItalicItem, EE_CHAR_ITALIC_CTL );
- const SfxPoolItem& rLangItem = rSet.Get( EE_CHAR_LANGUAGE );
- rSet.Put( rLangItem, EE_CHAR_LANGUAGE_CJK );
- rSet.Put( rLangItem, EE_CHAR_LANGUAGE_CTL );
-}
-
-void lcl_ModifyRTLDefaults( SfxItemSet& rSet )
-{
- rSet.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
-
- // always using rtl writing direction would break formulas
- //rSet.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
-
- // PaperSize width is limited to USHRT_MAX in RTL mode (because of EditEngine's
- // sal_uInt16 values in EditLine), so the text may be wrapped and line spacing must be
- // increased to not see the beginning of the next line.
- SvxLineSpacingItem aItem( SVX_LINESPACE_TWO_LINES, EE_PARA_SBL );
- aItem.SetPropLineSpace( 200 );
- rSet.Put( aItem );
-}
-
-void lcl_ModifyRTLVisArea( EditView* pEditView )
-{
- Rectangle aVisArea = pEditView->GetVisArea();
- Size aPaper = pEditView->GetEditEngine()->GetPaperSize();
- long nDiff = aPaper.Width() - aVisArea.Right();
- aVisArea.Left() += nDiff;
- aVisArea.Right() += nDiff;
- pEditView->SetVisArea(aVisArea);
-}
-
-void ScMultiTextWnd::StartEditEngine()
-{
- // Bei "eigener Modalitaet" (Doc-modale Dialoge) nicht aktivieren
-
- SfxObjectShell* pObjSh = SfxObjectShell::Current();
- if ( pObjSh && pObjSh->IsInModalMode() )
- return;
-
- if ( !pEditView || !pEditEngine )
- {
- InitEditEngine(pObjSh);
- }
-
- SC_MOD()->SetInputMode( SC_INPUT_TOP );
-
- SfxViewFrame* pViewFrm = SfxViewFrame::Current();
- if (pViewFrm)
- pViewFrm->GetBindings().Invalidate( SID_ATTR_INSERT );
-}
-
-void ScMultiTextWnd::InitEditEngine(SfxObjectShell* pObjSh)
-{
- ScFieldEditEngine* pNew;
- ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
- if ( pViewSh )
- {
- const ScDocument* pDoc = pViewSh->GetViewData()->GetDocument();
- pNew = new ScFieldEditEngine( pDoc->GetEnginePool(), pDoc->GetEditPool() );
- }
- else
- pNew = new ScFieldEditEngine( EditEngine::CreatePool(), NULL, sal_True );
- pNew->SetExecuteURL( false );
- pEditEngine = pNew;
-
- Size barSize=GetOutputSizePixel();
-
- long barHeight=barSize.Height();
- long textHeight=LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
- long nDiff = barHeight - textHeight;
-
- barSize.Height()=nDiff+barHeight;
- barSize.Width() -= 2*nTextStartPos-4;
- pEditEngine->SetUpdateMode( false );
- pEditEngine->SetPaperSize( PixelToLogic(Size(barSize.Width(),10000)) );
- pEditEngine->SetWordDelimiters(
- ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) );
-
- UpdateAutoCorrFlag();
-
- {
- SfxItemSet* pSet = new SfxItemSet( pEditEngine->GetEmptyItemSet() );
- pEditEngine->SetFontInfoInItemSet( *pSet, aTextFont );
- lcl_ExtendEditFontAttribs( *pSet );
- // turn off script spacing to match DrawText output
- pSet->Put( SvxScriptSpaceItem( false, EE_PARA_ASIANCJKSPACING ) );
- if ( bIsRTL )
- lcl_ModifyRTLDefaults( *pSet );
- pEditEngine->SetDefaults( pSet );
- }
-
- // Wenn in der Zelle URL-Felder enthalten sind, muessen die auch in
- // die Eingabezeile uebernommen werden, weil sonst die Positionen nicht stimmen.
-
- sal_Bool bFilled = false;
- ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
- if ( pHdl ) //! Testen, ob's der richtige InputHdl ist?
- bFilled = pHdl->GetTextAndFields( *pEditEngine );
-
- pEditEngine->SetUpdateMode( sal_True );
-
- // aString ist die Wahrheit...
- if ( bFilled && pEditEngine->GetText() == aString )
- Invalidate(); // Repaint fuer (hinterlegte) Felder
- else
- pEditEngine->SetText(aString); // dann wenigstens den richtigen Text
-
- pEditView = new EditView( pEditEngine, this );
- pEditView->SetInsertMode(bIsInsertMode);
-
- // Text aus Clipboard wird als ASCII einzeilig uebernommen
- sal_uLong n = pEditView->GetControlWord();
- pEditView->SetControlWord( n | EV_CNTRL_SINGLELINEPASTE );
-
- pEditEngine->InsertView( pEditView, EE_APPEND );
-
- Resize();
-
- if ( bIsRTL )
- lcl_ModifyRTLVisArea( pEditView );
-
- pEditEngine->SetModifyHdl(LINK(this, ScTextWnd, NotifyHdl));
-
- if (!maAccTextDatas.empty())
- maAccTextDatas.back()->StartEdit();
-
- // as long as EditEngine and DrawText sometimes differ for CTL text,
- // repaint now to have the EditEngine's version visible
-// SfxObjectShell* pObjSh = SfxObjectShell::Current();
- if ( pObjSh && pObjSh->ISA(ScDocShell) )
- {
- ScDocument* pDoc = ((ScDocShell*)pObjSh)->GetDocument(); // any document
- sal_uInt8 nScript = pDoc->GetStringScriptType( aString );
- if ( nScript & SCRIPTTYPE_COMPLEX )
- Invalidate();
- }
-}
-
-void ScMultiTextWnd::StopEditEngine( sal_Bool /*bAll*/ )
-{
-}
-
void ScTextWnd::StartEditEngine()
{
// Bei "eigener Modalitaet" (Doc-modale Dialoge) nicht aktivieren
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 60e3de3..98e6c2e 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -33,6 +33,7 @@
#include <vcl/toolbox.hxx>
#include <sfx2/childwin.hxx>
#include <svl/lstner.hxx>
+#include <vcl/button.hxx>
#include <vcl/combobox.hxx>
#include <vcl/window.hxx>
#include <svtools/transfer.hxx>
@@ -171,11 +172,14 @@ public:
ScMultiTextWnd( Window* pParent );
virtual void StartEditEngine();
virtual void StopEditEngine( sal_Bool bAll );
+ int GetLineCount();
+ virtual void Resize();
protected:
void InitEditEngine(SfxObjectShell* pObjSh);
virtual void Paint( const Rectangle& rRec );
- virtual void Resize();
+private:
+// bool bIsMultiLine;
};
class ScInputBarGroup : public ScTextWndBase
@@ -203,8 +207,11 @@ public:
private:
- ScMultiTextWnd aTextWindow;
- bool bIsMultiLine;
+ ScMultiTextWnd aMultiTextWnd;
+ PushButton aButton;
+// bool bIsMultiLine;
+
+ DECL_LINK( ClickHdl, PushButton* );
};
@@ -248,7 +255,8 @@ public:
void StateChanged( StateChangedType nType );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
-
+ void SetMultiLineStatus(bool bMode);
+ bool GetMultiLineStatus();
protected:
virtual void SetText( const String& rString );
@@ -267,6 +275,7 @@ private:
String aTextSum;
String aTextEqual;
sal_Bool bIsOkCancelMode;
+ bool bIsMultiLine;
};
//==================================================================
More information about the Libreoffice-commits
mailing list