cui/source/options/treeopt.cxx | 5 sc/UI_scalc.mk | 1 sc/source/ui/inc/anyrefdg.hxx | 50 ++++++- sc/source/ui/inc/namedefdlg.hxx | 42 ++---- sc/source/ui/miscdlgs/anyrefdg.cxx | 230 +++++++++++++++++++++++++----------- sc/source/ui/namedlg/namedefdlg.cxx | 174 +++++++++------------------ sc/uiconfig/scalc/ui/definename.ui | 55 +++++--- vcl/inc/vcl/layout.hxx | 49 ++++--- vcl/inc/vcl/tabpage.hxx | 2 vcl/source/control/tabctrl.cxx | 2 vcl/source/window/dialog.cxx | 3 vcl/source/window/layout.cxx | 12 + vcl/source/window/tabpage.cxx | 15 -- 13 files changed, 363 insertions(+), 277 deletions(-)
New commits: commit 5fa81385ca841d68d43fff9b4af7f55b5d4ab2c8 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Mar 5 10:51:49 2013 +0000 adapt code to define name .ui conversion This is a bit of a pig, the RefButton does a magic shrink of the dialog to just two widgets. This happens in a baseclass which has other users so for the time being switch off being in a layout enabled dialog to do the right thing depending on that. On the bright side, for the other expandable element we can now use a VclExpander and throw away the custom resize, reposition, etc. code for that. Change-Id: I9f2ab8a8d1bd28ee873ec8548a26131eab597763 diff --git a/sc/UI_scalc.mk b/sc/UI_scalc.mk index 990fb26..9c7e1da 100644 --- a/sc/UI_scalc.mk +++ b/sc/UI_scalc.mk @@ -11,6 +11,7 @@ $(eval $(call gb_UI_UI,modules/scalc)) $(eval $(call gb_UI_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/cellprotectionpage \ + sc/uiconfig/scalc/ui/definename \ sc/uiconfig/scalc/ui/insertsheet \ sc/uiconfig/scalc/ui/printeroptions \ sc/uiconfig/scalc/ui/sortcriteriapage \ diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 2040767..0e847ac 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -53,7 +53,8 @@ class ScFormulaReferenceHelper SfxBindings* m_pBindings; ::std::auto_ptr<Accelerator> pAccel; // for Enter/Escape - bool* pHiddenMarks; // Mark field for hidden Controls + ::std::vector<Window*> m_aHiddenWidgets; // vector of hidden Controls + sal_Int32 m_nOldBorderWidth; // border width for expanded dialog SCTAB nRefTab; // used for ShowReference String sOldDialogText; // Original title of the dialog window @@ -196,7 +197,11 @@ public: private: template<class TBindings, class TChildWindow, class TParentWindow, class TResId> ScRefHdlrImplBase( TBindings* pB, TChildWindow* pCW, - TParentWindow* pParent, TResId nResId); + TParentWindow* pParent, TResId nResId ); + + template<class TBindings, class TChildWindow, class TParentWindow > + ScRefHdlrImplBase( TBindings* pB, TChildWindow* pCW, + TParentWindow* pParent, const OString& rID, const OUString& rUIXMLDescription ); template<class TParentWindow, class TResId, class TArg> ScRefHdlrImplBase( TParentWindow* pParent, TResId nResId, const TArg &rArg, SfxBindings *pB = NULL ); @@ -209,12 +214,28 @@ private: template<class TWindow, bool bBindRef> template<class TBindings, class TChildWindow, class TParentWindow, class TResId> ScRefHdlrImplBase<TWindow, bBindRef>::ScRefHdlrImplBase( TBindings* pB, TChildWindow* pCW, - TParentWindow* pParent, TResId nResId):TWindow(pB, pCW, pParent, ScResId(static_cast<sal_uInt16>( nResId ) ) ), ScRefHandler( *static_cast<TWindow*>(this), pB, bBindRef ){} + TParentWindow* pParent, TResId nResId) + : TWindow(pB, pCW, pParent, ScResId(static_cast<sal_uInt16>( nResId ) ) ) + , ScRefHandler( *static_cast<TWindow*>(this), pB, bBindRef ) +{ +} + +template<class TWindow, bool bBindRef> +template<class TBindings, class TChildWindow, class TParentWindow> +ScRefHdlrImplBase<TWindow, bBindRef>::ScRefHdlrImplBase( TBindings* pB, TChildWindow* pCW, + TParentWindow* pParent, const OString& rID, const OUString& rUIXMLDescription ) + : TWindow(pB, pCW, pParent, rID, rUIXMLDescription ) + , ScRefHandler( *static_cast<TWindow*>(this), pB, bBindRef ) +{ +} template<class TWindow, bool bBindRef > template<class TParentWindow, class TResId, class TArg> ScRefHdlrImplBase<TWindow,bBindRef>::ScRefHdlrImplBase( TParentWindow* pParent, TResId nResIdP, const TArg &rArg, SfxBindings *pB ) -:TWindow( pParent, ScResId(static_cast<sal_uInt16>( nResIdP )), rArg ), ScRefHandler( *static_cast<TWindow*>(this), pB, bBindRef ){} + : TWindow( pParent, ScResId(static_cast<sal_uInt16>( nResIdP )), rArg ), + ScRefHandler( *static_cast<TWindow*>(this), pB, bBindRef ) +{ +} template<class TWindow, bool bBindRef > ScRefHdlrImplBase<TWindow,bBindRef>::~ScRefHdlrImplBase(){} @@ -246,7 +267,15 @@ struct ScRefHdlrImpl: ScRefHdlrImplBase< TBase, bBindRef > enum { UNKNOWN_SLOTID = 0U, SLOTID = UNKNOWN_SLOTID }; template<class T1, class T2, class T3, class T4> - ScRefHdlrImpl( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4 ):ScRefHdlrImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4 ) + ScRefHdlrImpl( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4 ) + : ScRefHdlrImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4) + { + SC_MOD()->RegisterRefWindow( static_cast<sal_uInt16>( static_cast<TDerived*>(this)->SLOTID ), this ); + } + + template<class T1, class T2, class T3, class T4, class T5> + ScRefHdlrImpl( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4, const T5& rt5 ) + : ScRefHdlrImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4, rt5) { SC_MOD()->RegisterRefWindow( static_cast<sal_uInt16>( static_cast<TDerived*>(this)->SLOTID ), this ); } @@ -260,7 +289,16 @@ struct ScRefHdlrImpl: ScRefHdlrImplBase< TBase, bBindRef > struct ScAnyRefDlg : ::ScRefHdlrImpl< ScAnyRefDlg, SfxModelessDialog> { template<class T1, class T2, class T3, class T4> - ScAnyRefDlg( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4 ):ScRefHdlrImpl< ScAnyRefDlg, SfxModelessDialog>(rt1, rt2, rt3, rt4){} + ScAnyRefDlg( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4 ) + : ScRefHdlrImpl< ScAnyRefDlg, SfxModelessDialog>(rt1, rt2, rt3, rt4) + { + } + + template<class T1, class T2, class T3, class T4, class T5> + ScAnyRefDlg( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4, const T5& rt5 ) + : ScRefHdlrImpl< ScAnyRefDlg, SfxModelessDialog>(rt1, rt2, rt3, rt4, rt5) + { + } }; //============================================================================ diff --git a/sc/source/ui/inc/namedefdlg.hxx b/sc/source/ui/inc/namedefdlg.hxx index aebaa8f..8aaa937 100644 --- a/sc/source/ui/inc/namedefdlg.hxx +++ b/sc/source/ui/inc/namedefdlg.hxx @@ -43,47 +43,40 @@ class ScViewData; class ScNameDefDlg : public ScAnyRefDlg { private: - Edit maEdName; + Edit* m_pEdName; - formula::RefEdit maEdRange; - formula::RefButton maRbRange; + formula::RefEdit* m_pEdRange; + formula::RefButton* m_pRbRange; - ListBox maLbScope; + ListBox* m_pLbScope; - DisclosureButton maBtnMore; - CheckBox maBtnRowHeader; - CheckBox maBtnColHeader; - CheckBox maBtnPrintArea; - CheckBox maBtnCriteria; - - PushButton maBtnAdd; - PushButton maBtnCancel; - FixedText maFtInfo; - FixedText maFtName; - FixedText maFtRange; - FixedText maFtScope; - FixedLine maFlDiv; + CheckBox* m_pBtnRowHeader; + CheckBox* m_pBtnColHeader; + CheckBox* m_pBtnPrintArea; + CheckBox* m_pBtnCriteria; + PushButton* m_pBtnAdd; + PushButton* m_pBtnCancel; + FixedText* m_pFtInfo; bool mbUndo; //if true we need to add an undo action after creating a range name ScDocument* mpDoc; ScDocShell* mpDocShell; ScAddress maCursorPos; - const rtl::OUString maGlobalNameStr; - const rtl::OUString maErrInvalidNameStr; - const rtl::OUString maErrNameInUse; - const rtl::OUString maStrInfoDefault; + OUString maStrInfoDefault; + const OUString maGlobalNameStr; + const OUString maErrInvalidNameStr; + const OUString maErrNameInUse; //hack to call this dialog from Manage Names - rtl::OUString maName; - rtl::OUString maScope; + OUString maName; + OUString maScope; std::map<rtl::OUString, ScRangeName*> maRangeMap; void CancelPushed(); void AddPushed(); - void MorePushed(); bool IsNameValid(); bool IsFormulaValid(); @@ -92,7 +85,6 @@ private: DECL_LINK( AddBtnHdl, void* ); DECL_LINK( NameModifyHdl, void* ); DECL_LINK( AssignGetFocusHdl, void * ); - DECL_LINK( MoreBtnHdl, void* ); protected: virtual void RefInputDone( sal_Bool bForced = sal_False ); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 396cf36..d5b0fed 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -49,7 +49,6 @@ ScFormulaReferenceHelper::ScFormulaReferenceHelper(IAnyRefDialog* _pDlg,SfxBindi , m_pWindow(NULL) , m_pBindings(_pBindings) , pAccel( NULL ) - , pHiddenMarks(NULL) , nRefTab(0) , mpOldEditParent( NULL ) , bHighLightRef( false ) @@ -346,7 +345,9 @@ IMPL_LINK( ScFormulaReferenceHelper, AccelSelectHdl, Accelerator *, pSelAccel ) } return true; } -//---------------------------------------------------------------------------- + +typedef std::vector<Window*> winvec; + void ScFormulaReferenceHelper::RefInputDone( bool bForced ) { if ( CanInputDone( bForced ) ) @@ -357,39 +358,82 @@ void ScFormulaReferenceHelper::RefInputDone( bool bForced ) bAccInserted = false; } - // restore the parent of the edit field - pRefEdit->SetParent(mpOldEditParent); + bool bLayoutEnabled = isLayoutEnabled(m_pWindow); + //get rid of all this junk when we can + if (!bLayoutEnabled) + { + m_pWindow->SetOutputSizePixel(aOldDialogSize); - // Fenstertitel anpassen - m_pWindow->SetText(sOldDialogText); + // restore the parent of the edit field + pRefEdit->SetParent(mpOldEditParent); - // Fenster wieder gross - m_pWindow->SetOutputSizePixel(aOldDialogSize); + // Fenster wieder gross + m_pWindow->SetOutputSizePixel(aOldDialogSize); - // pEditCell an alte Position - pRefEdit->SetPosSizePixel(aOldEditPos, aOldEditSize); + // pEditCell an alte Position + pRefEdit->SetPosSizePixel(aOldEditPos, aOldEditSize); - // set button position and image + // set button position + if( pRefBtn ) + { + pRefBtn->SetParent(m_pWindow); + pRefBtn->SetPosPixel( aOldButtonPos ); + } + } + + // Fenstertitel anpassen + m_pWindow->SetText(sOldDialogText); + + // set button image if( pRefBtn ) - { - pRefBtn->SetParent(m_pWindow); - pRefBtn->SetPosPixel( aOldButtonPos ); pRefBtn->SetStartImage(); - } // Alle anderen: Show(); - sal_uInt16 nChildren = m_pWindow->GetChildCount(); - for ( sal_uInt16 i = 0; i < nChildren; i++ ) - if (pHiddenMarks[i]) - { - m_pWindow->GetChild(i)->GetWindow( WINDOW_CLIENT )->Show(); - } - delete [] pHiddenMarks; + for (winvec::iterator aI = m_aHiddenWidgets.begin(); aI != m_aHiddenWidgets.end(); ++aI) + { + Window *pWindow = *aI; + pWindow->Show(); + } + m_aHiddenWidgets.clear(); + + if (bLayoutEnabled) + { + Dialog* pResizeDialog = pRefEdit->GetParentDialog(); + pResizeDialog->set_border_width(m_nOldBorderWidth); + pResizeDialog->get_action_area()->Show(); + pResizeDialog->setInitialLayoutSize(); + } pRefEdit = NULL; pRefBtn = NULL; } } + +typedef std::set<Window*> winset; + +namespace +{ + void hideUnless(Window *pTop, const winset& rVisibleWidgets, + winvec &rWasVisibleWidgets) + { + for (Window* pChild = pTop->GetWindow(WINDOW_FIRSTCHILD); pChild; + pChild = pChild->GetWindow(WINDOW_NEXT)) + { + if (!pChild->IsVisible()) + continue; + if (rVisibleWidgets.find(pChild) == rVisibleWidgets.end()) + { + rWasVisibleWidgets.push_back(pChild); + pChild->Hide(); + } + else if (isContainerWindow(pChild)) + { + hideUnless(pChild, rVisibleWidgets, rWasVisibleWidgets); + } + } + } +} + // ----------------------------------------------------------------------------- void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton ) { @@ -404,68 +448,112 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula:: sNewDialogText = sOldDialogText; sNewDialogText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " )); - mpOldEditParent = pRefEdit->GetParent(); + bool bLayoutEnabled = isLayoutEnabled(m_pWindow); + //get rid of all the !bLayoutEnabled junk when we can + //after the last user of this is widget-layout-ified + if (!bLayoutEnabled) + { + mpOldEditParent = pRefEdit->GetParent(); + + // Alte Daten merken + aOldDialogSize = m_pWindow->GetOutputSizePixel(); + aOldEditPos = pRefEdit->GetPosPixel(); + aOldEditSize = pRefEdit->GetSizePixel(); + if (pRefBtn) + aOldButtonPos = pRefBtn->GetPosPixel(); + + pRefEdit->SetParent(m_pWindow); + if(pRefBtn) + pRefBtn->SetParent(m_pWindow); + } - // Alte Daten merken - aOldDialogSize = m_pWindow->GetOutputSizePixel(); - aOldEditPos = pRefEdit->GetPosPixel(); - aOldEditSize = pRefEdit->GetSizePixel(); - if (pRefBtn) - aOldButtonPos = pRefBtn->GetPosPixel(); + //collect up edit window contents to use for the title bar + for (Window* pChild = firstLogicalChildOfParent(m_pWindow); pChild; pChild = nextLogicalChildOfParent(m_pWindow, pChild)) + { + Window *pWin = pChild->GetWindow(WINDOW_CLIENT); + if (pWin == (Window*)pRefEdit || pWin == (Window*)pRefBtn) + continue; // do nothing + if (pChild->IsVisible() && pWin->GetType() == WINDOW_EDIT) + sNewDialogText += pWin->GetText(); + } - pRefEdit->SetParent(m_pWindow); - if(pRefBtn) - pRefBtn->SetParent(m_pWindow); + Dialog* pResizeDialog = NULL; - // Alle Elemente ausser EditCell und Button verstecken - sal_uInt16 nChildren = m_pWindow->GetChildCount(); - pHiddenMarks = new bool [nChildren]; - for (sal_uInt16 i = 0; i < nChildren; i++) + if (!bLayoutEnabled) { - pHiddenMarks[i] = false; - Window* pWin = m_pWindow->GetChild(i); - pWin = pWin->GetWindow( WINDOW_CLIENT ); - if (pWin == (Window*)pRefEdit) + for (Window* pChild = m_pWindow->GetWindow(WINDOW_FIRSTCHILD); pChild; + pChild = pChild->GetWindow(WINDOW_NEXT)) { - sNewDialogText += m_pWindow->GetChild(i-1)->GetWindow( WINDOW_CLIENT )->GetText(); + Window *pWin = pChild->GetWindow(WINDOW_CLIENT); + if (pWin == (Window*)pRefEdit || pWin == (Window*)pRefBtn) + continue; // do nothing + else if (pWin->IsVisible()) + { + m_aHiddenWidgets.push_back(pChild); + pChild->Hide(); + } } - else if (pWin == (Window*)pRefBtn) - ; // do nothing - else if (pWin->IsVisible()) + } + else + { + //We want just pRefBtn and pRefEdit to be shown + //mark widgets we want to be visible, starting with pRefEdit + //and all its direct parents. + winset m_aVisibleWidgets; + pResizeDialog = pRefEdit->GetParentDialog(); + Window *pContentArea = pResizeDialog->get_content_area(); + for (Window *pCandidate = pRefEdit; + pCandidate != pContentArea && pCandidate->IsVisible(); + pCandidate = pCandidate->GetWindow(WINDOW_REALPARENT)) { - pHiddenMarks[i] = true; - pWin->Hide(); + m_aVisibleWidgets.insert(pCandidate); } + //same again with pRefBtn, except stop if there's a + //shared parent in the existing widgets + for (Window *pCandidate = pRefBtn; + pCandidate != pContentArea && pCandidate->IsVisible(); + pCandidate = pCandidate->GetWindow(WINDOW_REALPARENT)) + { + if (m_aVisibleWidgets.insert(pCandidate).second) + break; + } + + //hide everything except the m_aVisibleWidgets + hideUnless(pContentArea, m_aVisibleWidgets, m_aHiddenWidgets); } - // Edit-Feld verschieben und anpassen - Size aNewDlgSize(aOldDialogSize.Width(), aOldEditSize.Height()); - Size aNewEditSize(aNewDlgSize); - long nOffset = 0; - if (pRefBtn) + if (!bLayoutEnabled) { - aNewEditSize.Width() -= pRefBtn->GetSizePixel().Width(); - aNewEditSize.Width() -= aOldButtonPos.X() - (aOldEditPos.X()+aOldEditSize.Width()); - - long nHeight = pRefBtn->GetSizePixel().Height(); - if ( nHeight > aOldEditSize.Height() ) + // Edit-Feld verschieben und anpassen + Size aNewDlgSize(aOldDialogSize.Width(), aOldEditSize.Height()); + Size aNewEditSize(aNewDlgSize); + long nOffset = 0; + if (pRefBtn) { - aNewDlgSize.Height() = nHeight; - nOffset = (nHeight-aOldEditSize.Height()) / 2; + aNewEditSize.Width() -= pRefBtn->GetSizePixel().Width(); + aNewEditSize.Width() -= aOldButtonPos.X() - (aOldEditPos.X()+aOldEditSize.Width()); + + long nHeight = pRefBtn->GetSizePixel().Height(); + if ( nHeight > aOldEditSize.Height() ) + { + aNewDlgSize.Height() = nHeight; + nOffset = (nHeight-aOldEditSize.Height()) / 2; + } + aNewEditSize.Width() -= nOffset; } - aNewEditSize.Width() -= nOffset; + pRefEdit->SetPosSizePixel(Point(nOffset, nOffset), aNewEditSize); + + // set button position + if( pRefBtn ) + pRefBtn->SetPosPixel( Point( aOldDialogSize.Width() - pRefBtn->GetSizePixel().Width(), 0 ) ); + + // Fenster verkleinern + m_pWindow->SetOutputSizePixel(aNewDlgSize); } - pRefEdit->SetPosSizePixel(Point(nOffset, nOffset), aNewEditSize); - // set button position and image + // set button image if( pRefBtn ) - { - pRefBtn->SetPosPixel( Point( aOldDialogSize.Width() - pRefBtn->GetSizePixel().Width(), 0 ) ); pRefBtn->SetEndImage(); - } - - // Fenster verkleinern - m_pWindow->SetOutputSizePixel(aNewDlgSize); // Fenstertitel anpassen m_pWindow->SetText( MnemonicGenerator::EraseAllMnemonicChars( sNewDialogText ) ); @@ -479,6 +567,14 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula:: } Application::InsertAccel( pAccel.get() ); bAccInserted = true; + + if (bLayoutEnabled) + { + m_nOldBorderWidth = pResizeDialog->get_border_width(); + pResizeDialog->set_border_width(0); + pResizeDialog->get_action_area()->Hide(); + pResizeDialog->setInitialLayoutSize(); + } } } // ----------------------------------------------------------------------------- diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index cb2f6f7..749bf24 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -51,24 +51,9 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, ScViewData* pViewData, std::map<rtl::OUString, ScRangeName*> aRangeMap, - const ScAddress& aCursorPos, const bool bUndo ) : - ScAnyRefDlg( pB, pCW, pParent, RID_SCDLG_NAMES_DEFINE ), - maEdName( this, ScResId( ED_NAME ) ), - maEdRange( this, this, ScResId( ED_RANGE ) ), - maRbRange( this, ScResId( RB_RANGE ), &maEdRange, this ), - maLbScope( this, ScResId( LB_SCOPE ) ), - maBtnMore( this, ScResId( BTN_MORE ) ), - maBtnRowHeader( this, ScResId( BTN_ROWHEADER ) ), - maBtnColHeader( this, ScResId( BTN_COLHEADER ) ), - maBtnPrintArea( this, ScResId( BTN_PRINTAREA ) ), - maBtnCriteria( this, ScResId( BTN_CRITERIA ) ), - maBtnAdd( this, ScResId( BTN_ADD ) ), - maBtnCancel( this, ScResId( BTN_CANCEL ) ), - maFtInfo( this, ScResId( FT_INFO ) ), - maFtName( this, ScResId( FT_NAME ) ), - maFtRange( this, ScResId( FT_RANGE ) ), - maFtScope( this, ScResId( FT_SCOPE ) ), - maFlDiv( this, ScResId( FL_DIV ) ), + const ScAddress& aCursorPos, const bool bUndo ) + : ScAnyRefDlg( pB, pCW, pParent, "DefineNameDialog", "modules/scalc/ui/definename.ui" ) + , mbUndo( bUndo ), mpDoc( pViewData->GetDocument() ), mpDocShell ( pViewData->GetDocShell() ), @@ -77,37 +62,39 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen maGlobalNameStr ( ScGlobal::GetRscString(STR_GLOBAL_SCOPE) ), maErrInvalidNameStr( ScGlobal::GetRscString(STR_ERR_NAME_INVALID)), maErrNameInUse ( ScGlobal::GetRscString(STR_ERR_NAME_EXISTS)), - maStrInfoDefault ( SC_RESSTR(STR_DEFAULT_INFO)), maRangeMap( aRangeMap ) { + get(m_pEdName, "edit"); + get(m_pEdRange, "range"); + get(m_pRbRange, "refbutton"); + m_pRbRange->SetReferences(this, m_pEdRange); + get(m_pLbScope, "scope"); + get(m_pBtnRowHeader, "rowheader"); + get(m_pBtnColHeader, "colheader"); + get(m_pBtnPrintArea, "printarea"); + get(m_pBtnCriteria, "filter"); + get(m_pBtnAdd, "add"); + get(m_pBtnCancel, "cancel"); + get(m_pFtInfo, "label"); + maStrInfoDefault = m_pFtInfo->GetText(); + // Initialize scope list. - maLbScope.InsertEntry(maGlobalNameStr); - maLbScope.SelectEntryPos(0); + m_pLbScope->InsertEntry(maGlobalNameStr); + m_pLbScope->SelectEntryPos(0); SCTAB n = mpDoc->GetTableCount(); for (SCTAB i = 0; i < n; ++i) { rtl::OUString aTabName; mpDoc->GetName(i, aTabName); - maLbScope.InsertEntry(aTabName); + m_pLbScope->InsertEntry(aTabName); } - maBtnCancel.SetClickHdl( LINK( this, ScNameDefDlg, CancelBtnHdl)); - maBtnAdd.SetClickHdl( LINK( this, ScNameDefDlg, AddBtnHdl )); - maBtnMore.SetClickHdl( LINK( this, ScNameDefDlg, MoreBtnHdl )); - maEdName.SetModifyHdl( LINK( this, ScNameDefDlg, NameModifyHdl )); - maEdRange.SetGetFocusHdl( LINK( this, ScNameDefDlg, AssignGetFocusHdl ) ); - - maFtInfo.SetStyle(WB_VCENTER); - maFtInfo.SetText(maStrInfoDefault); - - maBtnAdd.Disable(); // empty name is invalid + m_pBtnCancel->SetClickHdl( LINK( this, ScNameDefDlg, CancelBtnHdl)); + m_pBtnAdd->SetClickHdl( LINK( this, ScNameDefDlg, AddBtnHdl )); + m_pEdName->SetModifyHdl( LINK( this, ScNameDefDlg, NameModifyHdl )); + m_pEdRange->SetGetFocusHdl( LINK( this, ScNameDefDlg, AssignGetFocusHdl ) ); - maBtnRowHeader.Hide(); - maBtnColHeader.Hide(); - maBtnCriteria.Hide(); - maBtnPrintArea.Hide(); - - FreeResource(); + m_pBtnAdd->Disable(); // empty name is invalid String aAreaStr; ScRange aRange; @@ -116,11 +103,11 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen aRange.Format( aAreaStr, ABS_DREF3D, mpDoc, ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0) ); - maEdRange.SetText( aAreaStr ); + m_pEdRange->SetText( aAreaStr ); Selection aCurSel = Selection( 0, SELECTION_MAX ); - maEdName.GrabFocus(); - maEdName.SetSelection( aCurSel ); + m_pEdName->GrabFocus(); + m_pEdName->SetSelection( aCurSel ); } void ScNameDefDlg::CancelPushed() @@ -138,7 +125,7 @@ bool ScNameDefDlg::IsFormulaValid() { ScCompiler aComp( mpDoc, maCursorPos); aComp.SetGrammar( mpDoc->GetGrammar() ); - ScTokenArray* pCode = aComp.CompileString(maEdRange.GetText()); + ScTokenArray* pCode = aComp.CompileString(m_pEdRange->GetText()); if (pCode->GetCodeError()) { //TODO: info message @@ -154,8 +141,8 @@ bool ScNameDefDlg::IsFormulaValid() bool ScNameDefDlg::IsNameValid() { - rtl::OUString aScope = maLbScope.GetSelectEntry(); - rtl::OUString aName = maEdName.GetText(); + rtl::OUString aScope = m_pLbScope->GetSelectEntry(); + rtl::OUString aName = m_pEdName->GetText(); ScRangeName* pRangeName = NULL; if(aScope == maGlobalNameStr) @@ -167,45 +154,45 @@ bool ScNameDefDlg::IsNameValid() pRangeName = maRangeMap.find(aScope)->second; } - maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor()); + m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor()); if ( aName.isEmpty() ) { - maBtnAdd.Disable(); - maFtInfo.SetText(maStrInfoDefault); + m_pBtnAdd->Disable(); + m_pFtInfo->SetText(maStrInfoDefault); return false; } else if (!ScRangeData::IsNameValid( aName, mpDoc )) { - maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor()); - maFtInfo.SetText(maErrInvalidNameStr); - maBtnAdd.Disable(); + m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor()); + m_pFtInfo->SetText(maErrInvalidNameStr); + m_pBtnAdd->Disable(); return false; } else if (pRangeName->findByUpperName(ScGlobal::pCharClass->uppercase(aName))) { - maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor()); - maFtInfo.SetText(maErrNameInUse); - maBtnAdd.Disable(); + m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor()); + m_pFtInfo->SetText(maErrNameInUse); + m_pBtnAdd->Disable(); return false; } if (!IsFormulaValid()) { - maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor()); - maBtnAdd.Disable(); + m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor()); + m_pBtnAdd->Disable(); return false; } - maFtInfo.SetText(maStrInfoDefault); - maBtnAdd.Enable(); + m_pFtInfo->SetText(maStrInfoDefault); + m_pBtnAdd->Enable(); return true; } void ScNameDefDlg::AddPushed() { - rtl::OUString aScope = maLbScope.GetSelectEntry(); - rtl::OUString aName = maEdName.GetText(); - rtl::OUString aExpression = maEdRange.GetText(); + rtl::OUString aScope = m_pLbScope->GetSelectEntry(); + rtl::OUString aName = m_pEdName->GetText(); + rtl::OUString aExpression = m_pEdRange->GetText(); if (aName.isEmpty()) { @@ -245,10 +232,10 @@ void ScNameDefDlg::AddPushed() if (pNewEntry) { nType = nType - | (maBtnRowHeader .IsChecked() ? RT_ROWHEADER : RangeType(0)) - | (maBtnColHeader .IsChecked() ? RT_COLHEADER : RangeType(0)) - | (maBtnPrintArea .IsChecked() ? RT_PRINTAREA : RangeType(0)) - | (maBtnCriteria .IsChecked() ? RT_CRITERIA : RangeType(0)); + | (m_pBtnRowHeader->IsChecked() ? RT_ROWHEADER : RangeType(0)) + | (m_pBtnColHeader->IsChecked() ? RT_COLHEADER : RangeType(0)) + | (m_pBtnPrintArea->IsChecked() ? RT_PRINTAREA : RangeType(0)) + | (m_pBtnCriteria->IsChecked() ? RT_CRITERIA : RangeType(0)); pNewEntry->AddType(nType); } @@ -289,8 +276,8 @@ void ScNameDefDlg::AddPushed() { delete pNewEntry; Selection aCurSel = Selection( 0, SELECTION_MAX ); - maEdRange.GrabFocus(); - maEdRange.SetSelection( aCurSel ); + m_pEdRange->GrabFocus(); + m_pEdRange->SetSelection( aCurSel ); } } } @@ -304,7 +291,7 @@ void ScNameDefDlg::GetNewData(rtl::OUString& rName, rtl::OUString& rScope) sal_Bool ScNameDefDlg::IsRefInputMode() const { - return maEdRange.IsEnabled(); + return m_pEdRange->IsEnabled(); } void ScNameDefDlg::RefInputDone( sal_Bool bForced) @@ -315,14 +302,14 @@ void ScNameDefDlg::RefInputDone( sal_Bool bForced) void ScNameDefDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { - if ( maEdRange.IsEnabled() ) + if ( m_pEdRange->IsEnabled() ) { if ( rRef.aStart != rRef.aEnd ) - RefInputStart(&maEdRange); + RefInputStart(m_pEdRange); String aRefStr; rRef.Format( aRefStr, ABS_DREF3D, pDocP, ScAddress::Details(pDocP->GetAddressConvention(), 0, 0) ); - maEdRange.SetRefString( aRefStr ); + m_pEdRange->SetRefString( aRefStr ); } } @@ -333,49 +320,10 @@ sal_Bool ScNameDefDlg::Close() void ScNameDefDlg::SetActive() { - maEdRange.GrabFocus(); + m_pEdRange->GrabFocus(); RefInputDone(); } -namespace { - -void MoveWindow( Window& rButton, long nPixel) -{ - Point aPoint = rButton.GetPosPixel(); - aPoint.Y() += nPixel; - rButton.SetPosPixel(aPoint); -} - -} - -void ScNameDefDlg::MorePushed() -{ - Size nSize = GetSizePixel(); - - //depending on the state of the button, move all elements below up/down - long nPixel = 65; - if (!maBtnMore.GetState()) - { - nPixel *= -1; - maBtnRowHeader.Hide(); - maBtnColHeader.Hide(); - maBtnPrintArea.Hide(); - maBtnCriteria.Hide(); - } - else - { - maBtnRowHeader.Show(); - maBtnColHeader.Show(); - maBtnPrintArea.Show(); - maBtnCriteria.Show(); - } - nSize.Height() += nPixel; - SetSizePixel(nSize); - MoveWindow(maBtnAdd, nPixel); - MoveWindow(maBtnCancel, nPixel); - MoveWindow(maFlDiv, nPixel); -} - IMPL_LINK_NOARG(ScNameDefDlg, CancelBtnHdl) { CancelPushed(); @@ -400,10 +348,4 @@ IMPL_LINK_NOARG(ScNameDefDlg, AssignGetFocusHdl) return 0; } -IMPL_LINK_NOARG(ScNameDefDlg, MoreBtnHdl) -{ - MorePushed(); - return 0; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/uiconfig/scalc/ui/definename.ui b/sc/uiconfig/scalc/ui/definename.ui index b217086..6a2e933 100644 --- a/sc/uiconfig/scalc/ui/definename.ui +++ b/sc/uiconfig/scalc/ui/definename.ui @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> - <object class="GtkAction" id="action1"/> - <object class="GtkAction" id="action2"/> - <object class="GtkDialog" id="Define Name"> + <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkDialog" id="DefineNameDialog"> <property name="can_focus">False</property> - <property name="border_width">5</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Define Name</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> <property name="orientation">vertical</property> - <property name="spacing">2</property> + <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> @@ -21,6 +21,8 @@ <property name="label">gtk-add</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -57,9 +59,9 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="orientation">vertical</property> - <property name="spacing">10</property> + <property name="spacing">12</property> <child> - <object class="GtkLabel" id="label1"> + <object class="GtkLabel" id="label"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> @@ -76,13 +78,15 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="row_spacing">6</property> - <property name="column_spacing">15</property> + <property name="column_spacing">12</property> <child> <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label" translatable="yes">Name</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">edit</property> </object> <packing> <property name="left_attach">0</property> @@ -97,6 +101,8 @@ <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label" translatable="yes">Range</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">range</property> </object> <packing> <property name="left_attach">0</property> @@ -111,6 +117,8 @@ <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label" translatable="yes">Scope</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">scope</property> </object> <packing> <property name="left_attach">0</property> @@ -120,7 +128,7 @@ </packing> </child> <child> - <object class="GtkEntry" id="entry1"> + <object class="GtkEntry" id="edit"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">â¢</property> @@ -136,11 +144,14 @@ <object class="GtkBox" id="box2"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="spacing">6</property> <child> - <object class="GtkEntry" id="entry2"> + <object class="foruilo-RefEdit" id="range"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hexpand">True</property> <property name="invisible_char">â¢</property> + <property name="width_chars">42</property> </object> <packing> <property name="expand">False</property> @@ -149,10 +160,10 @@ </packing> </child> <child> - <object class="GtkImage" id="image1"> + <object class="foruilo-RefButton" id="refbutton"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-missing-image</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> </object> <packing> <property name="expand">False</property> @@ -169,9 +180,10 @@ </packing> </child> <child> - <object class="GtkComboBoxText" id="comboboxtext1"> + <object class="GtkComboBoxText" id="scope"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> <property name="entry_text_column">0</property> <property name="id_column">1</property> </object> @@ -190,17 +202,20 @@ </packing> </child> <child> - <object class="GtkExpander" id="expander1"> + <object class="GtkExpander" id="more"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="spacing">6</property> + <property name="resize_toplevel">True</property> <child> <object class="GtkGrid" id="grid2"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="row_spacing">6</property> - <property name="column_spacing">15</property> + <property name="column_spacing">12</property> + <property name="column_homogeneous">True</property> <child> - <object class="GtkCheckButton" id="checkbutton1"> + <object class="GtkCheckButton" id="printarea"> <property name="label" translatable="yes">_Print range</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -217,7 +232,7 @@ </packing> </child> <child> - <object class="GtkCheckButton" id="checkbutton2"> + <object class="GtkCheckButton" id="filter"> <property name="label" translatable="yes">_Filter</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -234,7 +249,7 @@ </packing> </child> <child> - <object class="GtkCheckButton" id="checkbutton3"> + <object class="GtkCheckButton" id="colheader"> <property name="label" translatable="yes">Repeat _column</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -251,7 +266,7 @@ </packing> </child> <child> - <object class="GtkCheckButton" id="checkbutton4"> + <object class="GtkCheckButton" id="rowheader"> <property name="label" translatable="yes">Repeat _row</property> <property name="visible">True</property> <property name="can_focus">True</property> commit ee53857e984fea54b7dc08b99079b38766f0b796 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Mar 5 16:26:22 2013 +0000 handle empty button boxes Change-Id: I5763970fc521bd5951576090732902ef156d8958 diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 82bc7c0..c488e20 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -433,8 +433,9 @@ VclButtonBox::Requisition VclButtonBox::calculatePrimarySecondaryRequisitions() nAccDimension = std::accumulate(aSubGroupSizes.begin(), aSubGroupSizes.end(), nAccDimension); - long nAvgDimension = nAccDimension / - (aMainGroupSizes.size() + aSubGroupSizes.size()); + size_t nTotalSize = aMainGroupSizes.size() + aSubGroupSizes.size(); + + long nAvgDimension = nTotalSize ? nAccDimension / nTotalSize : 0; long nMaxMainNonOutlier = getMaxNonOutlier(aMainGroupSizes, nAvgDimension); commit a7b318a6ea507c6e35dc3a11f02c1d205519655e Author: Caolán McNamara <caol...@redhat.com> Date: Tue Mar 5 14:42:07 2013 +0000 merge isLayoutEnableds Change-Id: I67e55fd6aac3e0c9b80c63ca682d3aca7be7d815 diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 8cb338c..5de1ae7 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -89,6 +89,7 @@ #include <unotools/optionsdlg.hxx> #include <unotools/viewoptions.hxx> #include <vcl/help.hxx> +#include <vcl/layout.hxx> #include <vcl/msgbox.hxx> #include <vcl/waitobj.hxx> #include "svtools/treelistentry.hxx" @@ -938,7 +939,7 @@ IMPL_LINK( OfaTreeOptionsDialog, ImplHandleTreeLayoutTimerHdl, void*, EMPTYARG ) if (pCurrentPageEntry && aTreeLB.GetParent(pCurrentPageEntry)) { OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pCurrentPageEntry->GetUserData(); - if (pPageInfo->m_pPage && pPageInfo->m_pPage->isLayoutEnabled()) + if (pPageInfo->m_pPage && ::isLayoutEnabled(pPageInfo->m_pPage)) SetPaneSize(pPageInfo->m_pPage); } return 0; @@ -1114,7 +1115,7 @@ void OfaTreeOptionsDialog::SelectHdl_Impl() { pPageInfo->m_pPage->Reset( *pGroupInfo->m_pInItemSet ); } - if (pPageInfo->m_pPage->isLayoutEnabled()) + if (::isLayoutEnabled(pPageInfo->m_pPage)) SetPaneSize(pPageInfo->m_pPage); } } diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx index 457a389..6327725 100644 --- a/vcl/inc/vcl/layout.hxx +++ b/vcl/inc/vcl/layout.hxx @@ -635,56 +635,59 @@ public: VCL_DLLPUBLIC Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize); -// retro-fitting utilities // - -//Get a Size which is large enough to contain all children with -//an equal amount of space at top left and bottom right -Size getLegacyBestSizeForChildren(const Window &rWindow); - -//Get first parent which is not a layout widget -Window* getNonLayoutParent(Window *pParent); - -//Get first real parent which is not a layout widget -Window* getNonLayoutRealParent(Window *pParent); - -//return true if this window and its stack of containers are all shown -bool isVisibleInLayout(const Window *pWindow); - -//return true if this window and its stack of containers are all enabled -bool isEnabledInLayout(const Window *pWindow); - //Get first window of a pTopLevel window as //if any intermediate layout widgets didn't exist //i.e. acts like pChild = pChild->GetWindow(WINDOW_FIRSTCHILD); //in a flat hierarchy where dialogs only have one layer //of children -Window* firstLogicalChildOfParent(Window *pTopLevel); +VCL_DLLPUBLIC Window* firstLogicalChildOfParent(Window *pTopLevel); //Get next window after pChild of a pTopLevel window as //if any intermediate layout widgets didn't exist //i.e. acts like pChild = pChild->GetWindow(WINDOW_NEXT); //in a flat hierarchy where dialogs only have one layer //of children -Window* nextLogicalChildOfParent(Window *pTopLevel, Window *pChild); +VCL_DLLPUBLIC Window* nextLogicalChildOfParent(Window *pTopLevel, Window *pChild); //Get previous window before pChild of a pTopLevel window as //if any intermediate layout widgets didn't exist //i.e. acts like pChild = pChild->GetWindow(WINDOW_PREV); //in a flat hierarchy where dialogs only have one layer //of children -Window* prevLogicalChildOfParent(Window *pTopLevel, Window *pChild); +VCL_DLLPUBLIC Window* prevLogicalChildOfParent(Window *pTopLevel, Window *pChild); + +//Returns true is the Window has a single child which is a container +VCL_DLLPUBLIC bool isLayoutEnabled(const Window *pWindow); -inline bool isContainerWindow(const Window &rWindow) +VCL_DLLPUBLIC inline bool isContainerWindow(const Window &rWindow) { WindowType eType = rWindow.GetType(); return (eType == WINDOW_CONTAINER || eType == WINDOW_SCROLLWINDOW); } -inline bool isContainerWindow(const Window *pWindow) +VCL_DLLPUBLIC inline bool isContainerWindow(const Window *pWindow) { return pWindow && isContainerWindow(*pWindow); } +// retro-fitting utilities // + +//Get a Size which is large enough to contain all children with +//an equal amount of space at top left and bottom right +Size getLegacyBestSizeForChildren(const Window &rWindow); + +//Get first parent which is not a layout widget +Window* getNonLayoutParent(Window *pParent); + +//Get first real parent which is not a layout widget +Window* getNonLayoutRealParent(Window *pParent); + +//return true if this window and its stack of containers are all shown +bool isVisibleInLayout(const Window *pWindow); + +//return true if this window and its stack of containers are all enabled +bool isEnabledInLayout(const Window *pWindow); + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/tabpage.hxx b/vcl/inc/vcl/tabpage.hxx index 04dafe3..3414ec7 100644 --- a/vcl/inc/vcl/tabpage.hxx +++ b/vcl/inc/vcl/tabpage.hxx @@ -53,8 +53,6 @@ public: virtual void ActivatePage(); virtual void DeactivatePage(); - bool isLayoutEnabled() const; - //To-Do, consider inheriting from VclContainer virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize); virtual void SetPosPixel(const Point& rNewPos); diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 04afb7a..337b766 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1950,7 +1950,7 @@ void TabControl::SetTabPage( sal_uInt16 nPageId, TabPage* pTabPage ) { if ( pTabPage ) { - DBG_ASSERT( !pTabPage->IsVisible() || pTabPage->isLayoutEnabled(), + DBG_ASSERT( !pTabPage->IsVisible() || isLayoutEnabled(pTabPage), "TabControl::SetTabPage() - Non-Layout Enabled Page is visible" ); if ( IsDefaultSize() ) diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 8683ab6..467de4b 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1179,8 +1179,7 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal bool Dialog::isLayoutEnabled() const { //pre dtor called, and single child is a container => we're layout enabled - const Window *pChild = mpDialogImpl ? GetWindow(WINDOW_FIRSTCHILD) : NULL; - return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT); + return mpDialogImpl ? ::isLayoutEnabled(this) : false; } Size Dialog::GetOptimalSize() const diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 88790f3..82bc7c0 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1637,4 +1637,11 @@ bool isEnabledInLayout(const Window *pWindow) return bEnabled; } +bool isLayoutEnabled(const Window *pWindow) +{ + //Child is a container => we're layout enabled + const Window *pChild = pWindow ? pWindow->GetWindow(WINDOW_FIRSTCHILD) : NULL; + return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx index 33a0b85..5a57d4e 100644 --- a/vcl/source/window/tabpage.cxx +++ b/vcl/source/window/tabpage.cxx @@ -200,16 +200,9 @@ void TabPage::DeactivatePage() { } -bool TabPage::isLayoutEnabled() const -{ - //Child is a container => we're layout enabled - const Window *pChild = GetWindow(WINDOW_FIRSTCHILD); - return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT); -} - Size TabPage::GetOptimalSize() const { - if (isLayoutEnabled()) + if (isLayoutEnabled(this)) return VclContainer::getLayoutRequisition(*GetWindow(WINDOW_FIRSTCHILD)); return getLegacyBestSizeForChildren(*this); } @@ -217,21 +210,21 @@ Size TabPage::GetOptimalSize() const void TabPage::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) { Window::SetPosSizePixel(rAllocPos, rAllocation); - if (isLayoutEnabled()) + if (isLayoutEnabled(this)) VclContainer::setLayoutAllocation(*GetWindow(WINDOW_FIRSTCHILD), Point(0, 0), rAllocation); } void TabPage::SetSizePixel(const Size& rAllocation) { Window::SetSizePixel(rAllocation); - if (isLayoutEnabled()) + if (isLayoutEnabled(this)) VclContainer::setLayoutAllocation(*GetWindow(WINDOW_FIRSTCHILD), Point(0, 0), rAllocation); } void TabPage::SetPosPixel(const Point& rAllocPos) { Window::SetPosPixel(rAllocPos); - if (isLayoutEnabled()) + if (isLayoutEnabled(this)) VclContainer::setLayoutAllocation(*GetWindow(WINDOW_FIRSTCHILD), Point(0, 0), GetOutputSizePixel()); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits