include/tools/rc.h | 10 - include/tools/rcid.h | 2 include/vcl/button.hxx | 1 include/vcl/layout.hxx | 18 ++ include/vcl/split.hxx | 1 rsc/inc/rscdb.hxx | 2 rsc/source/parser/rscicpx.cxx | 67 ------- rsc/source/parser/rscinit.cxx | 5 sc/AllLangResTarget_sc.mk | 1 sc/UIConfig_scalc.mk | 1 sc/source/ui/formdlg/dwfunctr.cxx | 270 +------------------------------- sc/source/ui/formdlg/dwfunctr.hrc | 26 --- sc/source/ui/formdlg/dwfunctr.src | 97 ----------- sc/source/ui/inc/dwfunctr.hxx | 30 --- sc/source/ui/sidebar/ScPanelFactory.cxx | 2 sc/uiconfig/scalc/ui/functionpanel.ui | 141 ++++++++++++++++ vcl/source/control/button.cxx | 20 -- vcl/source/window/builder.cxx | 8 vcl/source/window/layout.cxx | 139 +++++++++++++++- vcl/source/window/split.cxx | 5 20 files changed, 326 insertions(+), 520 deletions(-)
New commits: commit 602274c77fa8134ca097f4d60b9fb75cea0eff78 Author: Caolán McNamara <[email protected]> Date: Sun Oct 23 21:11:41 2016 +0100 no ImageButton loaded from .src now Change-Id: If6f6718e1e6d756b99a499deafa4310c76a75ad3 diff --git a/include/tools/rc.h b/include/tools/rc.h index 7759037..7eab5bf 100644 --- a/include/tools/rc.h +++ b/include/tools/rc.h @@ -77,16 +77,6 @@ namespace o3tl { template<> struct typed_flags<RscMenuItem> : is_typed_flags<RscMenuItem, 0xd6f> {}; } -// For "ImageButtons": -enum class RscImageButtonFlags { - Image = 0x01, - Symbol = 0x02, - State = 0x04 -}; -namespace o3tl { - template<> struct typed_flags<RscImageButtonFlags> : is_typed_flags<RscImageButtonFlags, 0x07> {}; -} - // For "Image": enum class RscImageFlags { ImageBitmap = 0x01, diff --git a/include/tools/rcid.h b/include/tools/rcid.h index 4d69c85..c88ee3c 100644 --- a/include/tools/rcid.h +++ b/include/tools/rcid.h @@ -49,8 +49,6 @@ #define RSC_BUTTON (RSC_NOTYPE + 0x45) #define RSC_PUSHBUTTON (RSC_NOTYPE + 0x46) -#define RSC_IMAGEBUTTON (RSC_NOTYPE + 0x4a) - #define RSC_EDIT (RSC_NOTYPE + 0x52) #define RSC_LISTBOX (RSC_NOTYPE + 0x55) diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index c7976b4..ff52187 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -500,7 +500,6 @@ private: public: ImageButton( vcl::Window* pParent, WinBits nStyle = 0 ); - ImageButton( vcl::Window* pParent, const ResId& rResId ); }; class VCL_DLLPUBLIC ImageRadioButton : public RadioButton diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx index 715a88f..cbcafe0 100644 --- a/rsc/inc/rscdb.hxx +++ b/rsc/inc/rscdb.hxx @@ -176,8 +176,6 @@ class RscTypCont RscArray * pLangGeo ); RscTop * InitClassControl( RscTop * pSuper ); RscTop * InitClassPushButton( RscTop * pSuper ); - RscTop * InitClassImageButton( RscTop * pSuper, RscTop * pClassImage, - RscEnum * pTriState ); RscTop * InitClassEdit( RscTop * pSuper ); RscTop * InitClassListBox( RscTop * pSuper, RscArray * pStrLst ); RscTop * InitClassFixedText( RscTop * pSuper ); diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx index e2514b8..c502047 100644 --- a/rsc/source/parser/rscicpx.cxx +++ b/rsc/source/parser/rscicpx.cxx @@ -281,73 +281,6 @@ RscTop * RscTypCont::InitClassPushButton( RscTop * pSuper ) return pClassPushButton; } -RscTop * RscTypCont::InitClassImageButton( RscTop * pSuper, - RscTop * pClassImage, - RscEnum * pTriState ) -{ - Atom nId; - RscTop * pClassImageButton; - - // initialize class - nId = pHS->getID( "ImageButton" ); - pClassImageButton = new RscClass( nId, RSC_IMAGEBUTTON, pSuper ); - pClassImageButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); - aNmTb.Put( nId, CLASSNAME, pClassImageButton ); - - // initialize variables - { - nId = aNmTb.Put( "ButtonImage", VARNAME ); - pClassImageButton->SetVariable( nId, pClassImage, nullptr, 0, - (sal_uInt32)RscImageButtonFlags::Image ); - } - // initialize variables - { - Atom nVarId; - RscEnum * pSymbol; - - aBaseLst.push_back( pSymbol = new RscEnum( pHS->getID( "EnumSymbolButton" ), RSC_NOTYPE ) ); - - SETCONST( pSymbol, "IMAGEBUTTON_DONTKNOW", SymbolType::DONTKNOW ); - SETCONST( pSymbol, "IMAGEBUTTON_IMAGE", SymbolType::IMAGE ); - SETCONST( pSymbol, "IMAGEBUTTON_ARROW_UP", SymbolType::ARROW_UP ); - SETCONST( pSymbol, "IMAGEBUTTON_ARROW_DOWN", SymbolType::ARROW_DOWN ); - SETCONST( pSymbol, "IMAGEBUTTON_ARROW_LEFT", SymbolType::ARROW_LEFT ); - SETCONST( pSymbol, "IMAGEBUTTON_ARROW_RIGHT", SymbolType::ARROW_RIGHT ); - SETCONST( pSymbol, "IMAGEBUTTON_SPIN_UP", SymbolType::SPIN_UP ); - SETCONST( pSymbol, "IMAGEBUTTON_SPIN_DOWN", SymbolType::SPIN_DOWN ); - SETCONST( pSymbol, "IMAGEBUTTON_SPIN_LEFT", SymbolType::SPIN_LEFT ); - SETCONST( pSymbol, "IMAGEBUTTON_SPIN_RIGHT", SymbolType::SPIN_RIGHT ); - SETCONST( pSymbol, "IMAGEBUTTON_FIRST", SymbolType::FIRST ); - SETCONST( pSymbol, "IMAGEBUTTON_LAST", SymbolType::LAST ); - SETCONST( pSymbol, "IMAGEBUTTON_PREV", SymbolType::PREV ); - SETCONST( pSymbol, "IMAGEBUTTON_NEXT", SymbolType::NEXT ); - SETCONST( pSymbol, "IMAGEBUTTON_PAGEUP", SymbolType::PAGEUP ); - SETCONST( pSymbol, "IMAGEBUTTON_PAGEDOWN", SymbolType::PAGEDOWN ); - SETCONST( pSymbol, "IMAGEBUTTON_PLAY", SymbolType::PLAY ); - SETCONST( pSymbol, "IMAGEBUTTON_REVERSEPLAY", SymbolType::REVERSEPLAY ); - SETCONST( pSymbol, "IMAGEBUTTON_STOP", SymbolType::STOP ); - SETCONST( pSymbol, "IMAGEBUTTON_PAUSE", SymbolType::PAUSE ); - SETCONST( pSymbol, "IMAGEBUTTON_WINDSTART", SymbolType::WINDSTART ); - SETCONST( pSymbol, "IMAGEBUTTON_WINDEND", SymbolType::WINDEND ); - SETCONST( pSymbol, "IMAGEBUTTON_WINDBACKWARD", SymbolType::WINDBACKWARD ); - SETCONST( pSymbol, "IMAGEBUTTON_WINDFORWARD", SymbolType::WINDFORWARD ); - - // add variable - nVarId = aNmTb.Put( "Symbol", VARNAME ); - pClassImageButton->SetVariable( nVarId, pSymbol, nullptr, 0, - (sal_uInt32)RscImageButtonFlags::Symbol ); - } - nId = aNmTb.Put( "State", VARNAME ); - pClassImageButton->SetVariable( nId, pTriState, nullptr, 0, - (sal_uInt32)RscImageButtonFlags::State ); - - INS_WINBIT(pClassImageButton,Repeat) - INS_WINBIT(pClassImageButton,SmallStyle) - INS_WINBIT(pClassImageButton,RectStyle) - - return pClassImageButton; -} - RscTop * RscTypCont::InitClassEdit( RscTop * pSuper ) { Atom nId; diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx index 735acef..68bb4f7 100644 --- a/rsc/source/parser/rscinit.cxx +++ b/rsc/source/parser/rscinit.cxx @@ -65,7 +65,6 @@ void RscTypCont::Init() RscTop * pClassControl; RscTop * pClassButton; RscTop * pClassPushButton; - RscTop * pClassImageButton; RscTop * pClassEdit; RscTop * pClassListBox; RscTop * pClassFixedText; @@ -306,10 +305,6 @@ void RscTypCont::Init() pRoot->Insert( pClassPushButton ); } { - pClassImageButton = InitClassImageButton( pClassPushButton, - pClassImage, pTriState ); - pRoot->Insert( pClassImageButton ); - pClassEdit = InitClassEdit( pClassControl ); pRoot->Insert( pClassEdit ); } diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index ebbe3c9..2ca4013 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -3777,26 +3777,6 @@ ImageButton::ImageButton( vcl::Window* pParent, WinBits nStyle ) : ImplInitStyle(); } -ImageButton::ImageButton( vcl::Window* pParent, const ResId& rResId ) : - PushButton( pParent, rResId.SetRT( RSC_IMAGEBUTTON ) ) -{ - RscImageButtonFlags nObjMask = (RscImageButtonFlags)ReadLongRes(); - - if ( RscImageButtonFlags::Image & nObjMask ) - { - SetModeImage( Image( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *rResId.GetResMgr() ) ) ); - IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) ); - } - - if ( RscImageButtonFlags::Symbol & nObjMask ) - SetSymbol( (SymbolType)ReadLongRes() ); - - if ( RscImageButtonFlags::State & nObjMask ) - SetState( (TriState)ReadLongRes() ); - - ImplInitStyle(); -} - void ImageButton::ImplInitStyle() { WinBits nStyle = GetStyle(); commit 6f660293885733e64602aa6144c36ed7e7b43faf Author: Caolán McNamara <[email protected]> Date: Sun Oct 23 21:43:48 2016 +0100 implement VclVPaned and decripple formula panel Change-Id: If87e481a5cf0ef34b469ac0440643b0a0e8a296c diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 7404630..4ed021f 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -16,6 +16,7 @@ #include <vcl/fixed.hxx> #include <vcl/IPrioritable.hxx> #include <vcl/scrbar.hxx> +#include <vcl/split.hxx> #include <vcl/vclmedit.hxx> #include <vcl/window.hxx> #include <vcl/vclptr.hxx> @@ -375,6 +376,23 @@ public: virtual void setAllocation(const Size &rAllocation) override; }; +class VCL_DLLPUBLIC VclVPaned : public VclContainer +{ +private: + VclPtr<Splitter> m_pSplitter; + long m_nPosition; + DECL_LINK(SplitHdl, Splitter*, void); + void arrange(const Size& rAllocation, long nFirstHeight, long nSecondHeight); +public: + VclVPaned(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN); + virtual ~VclVPaned() override { disposeOnce(); } + virtual void dispose() override; + virtual Size calculateRequisition() const override; + virtual void setAllocation(const Size &rAllocation) override; + long get_position() const { return m_nPosition; } + void set_position(long nPosition) { m_nPosition = nPosition; } +}; + class VCL_DLLPUBLIC VclFrame : public VclBin { private: diff --git a/include/vcl/split.hxx b/include/vcl/split.hxx index 13f9ad7..853163d 100644 --- a/include/vcl/split.hxx +++ b/include/vcl/split.hxx @@ -75,6 +75,7 @@ public: virtual void LoseFocus() override; virtual void KeyInput( const KeyEvent& rKEvt ) override; virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rPaintRect ) override; + virtual Size GetOptimalSize() const override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index a853c98..51ddbff 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -70,6 +70,7 @@ ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const css::uno::Reference<css aFont.SetColor(Color(COL_BLACK)); aFiFuncDesc->SetFont(aFont); aFiFuncDesc->SetBackground( GetBackground() ); //! never transparent? + aFiFuncDesc->set_height_request(5 * aFiFuncDesc->GetTextHeight()); Link<ListBox&,void> aLink=LINK( this, ScFunctionWin, SelHdl); aCatBox->SetSelectHdl(aLink); diff --git a/sc/uiconfig/scalc/ui/functionpanel.ui b/sc/uiconfig/scalc/ui/functionpanel.ui index 6a6fb56..c069660 100644 --- a/sc/uiconfig/scalc/ui/functionpanel.ui +++ b/sc/uiconfig/scalc/ui/functionpanel.ui @@ -2,11 +2,6 @@ <!-- Generated with glade 3.20.0 --> <interface> <requires lib="gtk+" version="3.0"/> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">sc/res/fx.png</property> - </object> <object class="GtkGrid" id="FunctionPanel"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -20,27 +15,67 @@ <property name="border_width">6</property> <property name="row_spacing">6</property> <child> - <object class="GtkGrid"> + <object class="GtkPaned" id="splitter"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="row_spacing">6</property> + <property name="orientation">vertical</property> + <property name="wide_handle">True</property> <child> <object class="GtkGrid"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="column_spacing">12</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> <child> - <object class="GtkButton" id="insert"> + <object class="GtkGrid"> <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="tooltip_text" translatable="yes">Insert Function into calculation sheet</property> - <property name="image">image1</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkButton" id="insert"> + <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="tooltip_text" translatable="yes">Insert Function into calculation sheet</property> + <property name="image">image1</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="category"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <items> + <item translatable="yes">Last Used</item> + <item translatable="yes">All</item> + <item translatable="yes">Database</item> + <item translatable="yes">Date&Time</item> + <item translatable="yes">Financial</item> + <item translatable="yes">Information</item> + <item translatable="yes">Logical</item> + <item translatable="yes">Mathematical</item> + <item translatable="yes">Array</item> + <item translatable="yes">Statistical</item> + <item translatable="yes">Spreadsheet</item> + <item translatable="yes">Text</item> + <item translatable="yes">Add-in</item> + </items> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> </object> <packing> <property name="left_attach">0</property> @@ -48,51 +83,41 @@ </packing> </child> <child> - <object class="GtkComboBoxText" id="category"> + <object class="GtkTreeView" id="funclist:border"> + <property name="name">functions</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> - <items> - <item translatable="yes">Last Used</item> - <item translatable="yes">All</item> - <item translatable="yes">Database</item> - <item translatable="yes">Date&Time</item> - <item translatable="yes">Financial</item> - <item translatable="yes">Information</item> - <item translatable="yes">Logical</item> - <item translatable="yes">Mathematical</item> - <item translatable="yes">Array</item> - <item translatable="yes">Statistical</item> - <item translatable="yes">Spreadsheet</item> - <item translatable="yes">Text</item> - <item translatable="yes">Add-in</item> - </items> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection"/> + </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left_attach">0</property> + <property name="top_attach">1</property> </packing> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="resize">True</property> + <property name="shrink">True</property> </packing> </child> <child> - <object class="GtkTreeView" id="funclist"> - <property name="name">functions</property> + <object class="GtkLabel" id="funcdesc:border"> + <property name="name">funcdesc</property> + <property name="width_request">0</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child internal-child="selection"> - <object class="GtkTreeSelection"/> - </child> + <property name="can_focus">False</property> + <property name="label" translatable="yes">label</property> + <property name="wrap">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="resize">False</property> + <property name="shrink">True</property> </packing> </child> </object> @@ -101,22 +126,6 @@ <property name="top_attach">0</property> </packing> </child> - <child> - <object class="GtkLabel" id="funcdesc"> - <property name="name">funcdesc</property> - <property name="width_request">0</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">label</property> - <property name="wrap">True</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> </object> <packing> <property name="left_attach">0</property> @@ -124,4 +133,9 @@ </packing> </child> </object> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sc/res/fx.png</property> + </object> </interface> diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index ddaedf0..a117a92 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1346,6 +1346,12 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & else xWindow = VclPtr<VclHBox>::Create(pParent); } + else if (name == "GtkPaned") + { + bVertical = extractOrientation(rMap); + assert(bVertical && "hori not implemented, shouldn't be hard though"); + xWindow = VclPtr<VclVPaned>::Create(pParent); + } else if (name == "GtkHBox") xWindow = VclPtr<VclHBox>::Create(pParent); else if (name == "GtkVBox") @@ -2992,7 +2998,7 @@ void VclBuilder::applyPackingProperty(vcl::Window *pCurrent, xmlreader::XmlReader::Text::Raw, &name, &nsId); OString sValue(name.begin, name.length); - if (sKey == "expand") + if (sKey == "expand" || sKey == "resize") { bool bTrue = (!sValue.isEmpty() && (sValue[0] == 't' || sValue[0] == 'T' || sValue[0] == '1')); if (pToolBoxParent) diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index cfaec6b..884e5e0 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -115,15 +115,23 @@ void VclContainer::setLayoutAllocation(vcl::Window &rChild, const Point &rAllocP setLayoutPosSize(rChild, aChildPos, aChildSize); } +namespace +{ + Size subtractBorder(const vcl::Window &rWindow, const Size& rSize) + { + sal_Int32 nBorderWidth = rWindow.get_border_width(); + sal_Int32 nLeft = rWindow.get_margin_left() + nBorderWidth; + sal_Int32 nTop = rWindow.get_margin_top() + nBorderWidth; + sal_Int32 nRight = rWindow.get_margin_right() + nBorderWidth; + sal_Int32 nBottom = rWindow.get_margin_bottom() + nBorderWidth; + Size aSize(rSize); + return Size(aSize.Width() + nLeft + nRight, aSize.Height() + nTop + nBottom); + } +} + Size VclContainer::getLayoutRequisition(const vcl::Window &rWindow) { - sal_Int32 nBorderWidth = rWindow.get_border_width(); - sal_Int32 nLeft = rWindow.get_margin_left() + nBorderWidth; - sal_Int32 nTop = rWindow.get_margin_top() + nBorderWidth; - sal_Int32 nRight = rWindow.get_margin_right() + nBorderWidth; - sal_Int32 nBottom = rWindow.get_margin_bottom() + nBorderWidth; - Size aSize(rWindow.get_preferred_size()); - return Size(aSize.Width() + nLeft + nRight, aSize.Height() + nTop + nBottom); + return subtractBorder(rWindow, rWindow.get_preferred_size()); } void VclContainer::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) @@ -2515,6 +2523,123 @@ void MessageDialog::set_secondary_text(const OUString &rSecondaryString) } } +VclVPaned::VclVPaned(vcl::Window *pParent, WinBits nStyle) + : VclContainer(pParent, nStyle) + , m_pSplitter(VclPtr<Splitter>::Create(this, WB_VSCROLL)) + , m_nPosition(-1) +{ + m_pSplitter->SetSplitHdl(LINK(this, VclVPaned, SplitHdl)); + m_pSplitter->SetBackground(Wallpaper(Application::GetSettings().GetStyleSettings().GetFaceColor())); + m_pSplitter->Show(); +} + +void VclVPaned::dispose() +{ + m_pSplitter.disposeAndClear(); + VclContainer::dispose(); +} + +IMPL_LINK(VclVPaned, SplitHdl, Splitter*, pSplitter, void) +{ + double nSize = pSplitter->GetSplitPosPixel(); + Size aSplitterSize(m_pSplitter->GetSizePixel()); + Size aAllocation(GetSizePixel()); + arrange(aAllocation, nSize, aAllocation.Height() - nSize - aSplitterSize.Height()); +} + +void VclVPaned::arrange(const Size& rAllocation, long nFirstHeight, long nSecondHeight) +{ + Size aSplitterSize(rAllocation.Width(), getLayoutRequisition(*m_pSplitter).Height()); + Size aFirstChildSize(rAllocation.Width(), nFirstHeight); + Size aSecondChildSize(rAllocation.Width(), nSecondHeight); + int nElement = 0; + for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild; + pChild = pChild->GetWindow(GetWindowType::Next)) + { + if (!pChild->IsVisible()) + continue; + if (nElement == 0) + { + Point aSplitterPos(0, aFirstChildSize.Height()); + setLayoutAllocation(*m_pSplitter, aSplitterPos, aSplitterSize); + set_position(aSplitterPos.Y() + aSplitterSize.Height() / 2); + } + else if (nElement == 1) + { + Point aChildPos(0, 0); + setLayoutAllocation(*pChild, aChildPos, aFirstChildSize); + } + else if (nElement == 2) + { + Point aChildPos(0, aFirstChildSize.Height() + aSplitterSize.Height()); + setLayoutAllocation(*pChild, aChildPos, aSecondChildSize); + } + ++nElement; + } +} + +void VclVPaned::setAllocation(const Size& rAllocation) +{ + //supporting "shrink" could be done by adjusting the allowed drag rectangle + m_pSplitter->SetDragRectPixel(Rectangle(Point(0, 0), rAllocation)); + Size aSplitterSize(rAllocation.Width(), getLayoutRequisition(*m_pSplitter).Height()); + const long nHeight = rAllocation.Height() - aSplitterSize.Height(); + + long nFirstHeight = 0; + long nSecondHeight = 0; + bool bFirstCanResize = true; + bool bSecondCanResize = true; + const bool bInitialAllocation = get_position() < 0; + int nElement = 0; + for (const vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild; + pChild = pChild->GetWindow(GetWindowType::Next)) + { + if (!pChild->IsVisible()) + continue; + if (nElement == 1) + { + if (bInitialAllocation) + nFirstHeight = getLayoutRequisition(*pChild).Height(); + else + nFirstHeight = pChild->GetSizePixel().Height(); + bFirstCanResize = pChild->get_expand(); + } + else if (nElement == 2) + { + if (bInitialAllocation) + nSecondHeight = getLayoutRequisition(*pChild).Height(); + else + nSecondHeight = pChild->GetSizePixel().Height(); + bSecondCanResize = pChild->get_expand(); + } + ++nElement; + } + long nHeightRequest = nFirstHeight + nSecondHeight; + long nHeightDiff = nHeight - nHeightRequest; + if (bFirstCanResize == bSecondCanResize) + nFirstHeight += nHeightDiff/2; + else if (bFirstCanResize) + nFirstHeight += nHeightDiff; + arrange(rAllocation, nFirstHeight, nSecondHeight); +} + +Size VclVPaned::calculateRequisition() const +{ + Size aRet(0, 0); + + for (const vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild; + pChild = pChild->GetWindow(GetWindowType::Next)) + { + if (!pChild->IsVisible()) + continue; + Size aChildSize = getLayoutRequisition(*pChild); + aRet.Width() = std::max(aRet.Width(), aChildSize.Width()); + aRet.Height() += aChildSize.Height(); + } + + return aRet; +} + Size getLegacyBestSizeForChildren(const vcl::Window &rWindow) { Rectangle aBounds; diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx index 2dbe388..eb6da6e 100644 --- a/vcl/source/window/split.cxx +++ b/vcl/source/window/split.cxx @@ -694,4 +694,9 @@ void Splitter::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rPaint } } +Size Splitter::GetOptimalSize() const +{ + return LogicToPixel(Size(3, 3), MapUnit::MapAppFont); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit a2ba500c70292a33e7b34a6428cc86c17078a72c Author: Caolán McNamara <[email protected]> Date: Sun Oct 23 20:55:26 2016 +0100 convert function panel to .ui format Change-Id: I79e069aa9bd15642d969d5829a5ad2fa2d264d6c diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk index 9708c7b..6674502 100644 --- a/sc/AllLangResTarget_sc.mk +++ b/sc/AllLangResTarget_sc.mk @@ -43,7 +43,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\ sc/source/ui/miscdlgs/retypepassdlg.src \ sc/source/ui/miscdlgs/conflictsdlg.src \ sc/source/ui/miscdlgs/acredlin.src \ - sc/source/ui/formdlg/dwfunctr.src \ sc/source/ui/sidebar/CellAppearancePropertyPanel.src \ sc/source/ui/StatisticsDialogs/StatisticsDialogs.src \ sc/source/core/src/compiler.src \ diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 5008729..d50164b 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -127,6 +127,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/formulacalculationoptions \ sc/uiconfig/scalc/ui/floatingborderstyle \ sc/uiconfig/scalc/ui/floatinglinestyle \ + sc/uiconfig/scalc/ui/functionpanel \ sc/uiconfig/scalc/ui/goalseekdlg \ sc/uiconfig/scalc/ui/groupdialog \ sc/uiconfig/scalc/ui/groupbydate \ diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 772267c..a853c98 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -36,7 +36,6 @@ #include "appoptio.hxx" #include "compiler.hxx" -#include "dwfunctr.hrc" #include "dwfunctr.hxx" /************************************************************************* @@ -53,17 +52,16 @@ #* #************************************************************************/ -ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const ResId& rResId) : - vcl::Window(pParent, rResId), - aCatBox ( VclPtr<ListBox>::Create( this, ResId( CB_CAT, *rResId.GetResMgr() ) ) ), - aFuncList ( VclPtr<ListBox>::Create( this, ResId( LB_FUNC, *rResId.GetResMgr() ) ) ), - aInsertButton ( VclPtr<ImageButton>::Create( this, ResId( IMB_INSERT, *rResId.GetResMgr() ) ) ), - aFiFuncDesc ( VclPtr<FixedText>::Create( this, ResId( FI_FUNCDESC, *rResId.GetResMgr() ) ) ), - pFuncDesc (nullptr) +ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame> &rFrame) + : PanelLayout(pParent, "FunctionPanel", "modules/scalc/ui/functionpanel.ui", rFrame) + , pFuncDesc(nullptr) { - FreeResource(); + get(aCatBox, "category"); + get(aFuncList, "funclist"); + get(aInsertButton, "insert"); + get(aFiFuncDesc, "funcdesc"); + InitLRUList(); - SetStyle(GetStyle()|WB_CLIPCHILDREN); aFiFuncDesc->SetUpdateMode(true); nArgs=0; @@ -106,11 +104,11 @@ ScFunctionWin::~ScFunctionWin() void ScFunctionWin::dispose() { - aCatBox.disposeAndClear(); - aFuncList.disposeAndClear(); - aInsertButton.disposeAndClear(); - aFiFuncDesc.disposeAndClear(); - vcl::Window::dispose(); + aCatBox.clear(); + aFuncList.clear(); + aInsertButton.clear(); + aFiFuncDesc.clear(); + PanelLayout::dispose(); } /************************************************************************* diff --git a/sc/source/ui/formdlg/dwfunctr.hrc b/sc/source/ui/formdlg/dwfunctr.hrc deleted file mode 100644 index b025f13..0000000 --- a/sc/source/ui/formdlg/dwfunctr.hrc +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#define CB_CAT 1 -#define LB_FUNC 2 -#define IMB_INSERT 1 -#define FI_FUNCDESC 1 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/formdlg/dwfunctr.src b/sc/source/ui/formdlg/dwfunctr.src deleted file mode 100644 index 8c539e4..0000000 --- a/sc/source/ui/formdlg/dwfunctr.src +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "sc.hrc" -#include "dwfunctr.hrc" - -Window FID_FUNCTION_BOX -{ - SVLook = TRUE ; - Size = MAP_APPFONT ( 130 , 160 ) ; - HelpId = HID_FUNCTION_BOX ; - ListBox CB_CAT - { - HelpID = "sc:ListBox:FID_FUNCTION_BOX:CB_CAT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 20 , 4 ) ; - Size = MAP_APPFONT ( 56 , 80 ) ; - DropDown = TRUE ; - AutoSize = TRUE ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - StringList [ en-US ] = - { - < "Last Used" ; Default ; > ; - < "All" ; Default ; > ; - < "Database" ; Default ; > ; - < "Date&Time" ; Default ; > ; - < "Financial" ; Default ; > ; - < "Information" ; Default ; > ; - < "Logical" ; Default ; > ; - < "Mathematical" ; Default ; > ; - < "Array" ; Default ; > ; - < "Statistical" ; Default ; > ; - < "Spreadsheet" ; Default ; > ; - < "Text" ; Default ; > ; - < "Add-in" ; Default ; > ; - }; - }; - ListBox LB_FUNC - { - HelpID = "sc:ListBox:FID_FUNCTION_BOX:LB_FUNC"; - Border = TRUE ; - Pos = MAP_APPFONT ( 3 , 19 ) ; - Size = MAP_APPFONT ( 72 , 90 ) ; - TabStop = TRUE ; - AutoHScroll = TRUE ; - }; - FixedText FI_FUNCDESC - { - WordBreak = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 3 , 115 ) ; - Size = MAP_APPFONT ( 72 , 40 ) ; - }; - ImageButton IMB_INSERT - { - HelpID = "sc:ImageButton:FID_FUNCTION_BOX:IMB_INSERT"; - Pos = MAP_APPFONT ( 3 , 4 ) ; - Size = MAP_APPFONT ( 13 , 13 ) ; - TabStop = TRUE ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "fx.png"; - }; - }; - DefButton = TRUE ; - QuickHelpText [ en-US ] = "Insert Function into calculation sheet" ; - }; - Text [ en-US ] = "Functions" ; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx index 7352bb5..f9dcd86 100644 --- a/sc/source/ui/inc/dwfunctr.hxx +++ b/sc/source/ui/inc/dwfunctr.hxx @@ -26,22 +26,23 @@ #include <vcl/lstbox.hxx> #include <vcl/button.hxx> #include <vcl/combobox.hxx> +#include <svx/sidebar/PanelLayout.hxx> #include "anyrefdg.hxx" #include "global.hxx" #include "privsplt.hxx" #include "funcdesc.hxx" -class ScFunctionWin : public vcl::Window +class ScFunctionWin : public PanelLayout { private: VclPtr<ListBox> aCatBox; VclPtr<ListBox> aFuncList; - VclPtr<ImageButton> aInsertButton; + VclPtr<PushButton> aInsertButton; VclPtr<FixedText> aFiFuncDesc; const ScFuncDesc* pFuncDesc; - sal_uInt16 nArgs; + sal_uInt16 nArgs; ::std::vector< const formula::IFunctionDescription*> aLRUList; @@ -55,7 +56,7 @@ private: DECL_LINK( SelHdl, ListBox&, void ); public: - ScFunctionWin(vcl::Window* pParent, const ResId& rResId); + ScFunctionWin(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame> &rFrame); virtual ~ScFunctionWin() override; virtual void dispose() override; diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx index 02a060e..7665ebf 100644 --- a/sc/source/ui/sidebar/ScPanelFactory.cxx +++ b/sc/source/ui/sidebar/ScPanelFactory.cxx @@ -98,7 +98,7 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement ( } else if (rsResourceURL.endsWith("/FunctionsPanel")) { - pPanel = VclPtr<ScFunctionWin>::Create(pParentWindow, ScResId(FID_FUNCTION_BOX)); + pPanel = VclPtr<ScFunctionWin>::Create(pParentWindow, xFrame); nMinimumSize = 0; } diff --git a/sc/uiconfig/scalc/ui/functionpanel.ui b/sc/uiconfig/scalc/ui/functionpanel.ui new file mode 100644 index 0000000..6a6fb56 --- /dev/null +++ b/sc/uiconfig/scalc/ui/functionpanel.ui @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.0 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sc/res/fx.png</property> + </object> + <object class="GtkGrid" id="FunctionPanel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border_width">6</property> + <property name="row_spacing">6</property> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkButton" id="insert"> + <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="tooltip_text" translatable="yes">Insert Function into calculation sheet</property> + <property name="image">image1</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="category"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <items> + <item translatable="yes">Last Used</item> + <item translatable="yes">All</item> + <item translatable="yes">Database</item> + <item translatable="yes">Date&Time</item> + <item translatable="yes">Financial</item> + <item translatable="yes">Information</item> + <item translatable="yes">Logical</item> + <item translatable="yes">Mathematical</item> + <item translatable="yes">Array</item> + <item translatable="yes">Statistical</item> + <item translatable="yes">Spreadsheet</item> + <item translatable="yes">Text</item> + <item translatable="yes">Add-in</item> + </items> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkTreeView" id="funclist"> + <property name="name">functions</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection"/> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="funcdesc"> + <property name="name">funcdesc</property> + <property name="width_request">0</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">label</property> + <property name="wrap">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> +</interface> commit d02e96e0f29c9520c56221473c5bd731600b6e15 Author: Caolán McNamara <[email protected]> Date: Sun Oct 23 20:41:11 2016 +0100 temporarily cripple formula panel by removing FT_SPLIT Change-Id: I0a96a812b597aa657138ef061e4918018111cfa6 diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 935d471..772267c 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -55,25 +55,18 @@ ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const ResId& rResId) : vcl::Window(pParent, rResId), - aIdle ( "sc formdlg ScFunctionWin" ), - aPrivatSplit ( VclPtr<ScPrivatSplit>::Create( this, ResId( FT_SPLIT, *rResId.GetResMgr() ) ) ), aCatBox ( VclPtr<ListBox>::Create( this, ResId( CB_CAT, *rResId.GetResMgr() ) ) ), aFuncList ( VclPtr<ListBox>::Create( this, ResId( LB_FUNC, *rResId.GetResMgr() ) ) ), aInsertButton ( VclPtr<ImageButton>::Create( this, ResId( IMB_INSERT, *rResId.GetResMgr() ) ) ), aFiFuncDesc ( VclPtr<FixedText>::Create( this, ResId( FI_FUNCDESC, *rResId.GetResMgr() ) ) ), - aOldSize (0,0), pFuncDesc (nullptr) { FreeResource(); InitLRUList(); SetStyle(GetStyle()|WB_CLIPCHILDREN); - aIdle.SetPriority(SchedulerPriority::LOWER); - aIdle.SetIdleHdl(LINK( this, ScFunctionWin, TimerHdl)); - aFiFuncDesc->SetUpdateMode(true); nArgs=0; - bSizeFlag=false; aCatBox->SetDropDownLineCount(9); vcl::Font aFont=aFiFuncDesc->GetFont(); aFont.SetColor(Color(COL_BLACK)); @@ -87,20 +80,8 @@ ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const ResId& rResId) : aFuncList->SetDoubleClickHdl(LINK( this, ScFunctionWin, SetSelectionHdl)); aInsertButton->SetClickHdl(LINK( this, ScFunctionWin, SetSelectionClickHdl)); - Link<ScPrivatSplit&,void> a3Link=LINK( this, ScFunctionWin, SetSplitHdl); - aPrivatSplit->SetCtrModifiedHdl(a3Link); - - Point aTopLeft=aCatBox->GetPosPixel(); - OUString aString("ww"); - Size aTxtSize( aFiFuncDesc->GetTextWidth(aString), aFiFuncDesc->GetTextHeight() ); - nMinWidth=aTxtSize.Width()+aTopLeft.X() - +2*aFuncList->GetPosPixel().X(); - nMinHeight=19*aTxtSize.Height(); aCatBox->SelectEntryPos(0); - Range aYRange(3*aTxtSize.Height()+aFuncList->GetPosPixel().Y(), - GetOutputSizePixel().Height()-2*aTxtSize.Height()); - aPrivatSplit->SetYRange(aYRange); SelHdl(*aCatBox.get()); } @@ -125,7 +106,6 @@ ScFunctionWin::~ScFunctionWin() void ScFunctionWin::dispose() { - aPrivatSplit.disposeAndClear(); aCatBox.disposeAndClear(); aFuncList.disposeAndClear(); aInsertButton.disposeAndClear(); @@ -183,158 +163,6 @@ void ScFunctionWin::UpdateLRUList() } /************************************************************************* -#* Member: SetSize -#*------------------------------------------------------------------------ -#* -#* Klasse: ScFunctionWin -#* -#* Funktion: Groesse fuer die einzelnen Controls einzustellen. -#* -#* Input: --- -#* -#* Output: --- -#* -#************************************************************************/ - -void ScFunctionWin::SetSize() -{ - SetLeftRightSize(); -} - -/************************************************************************* -#* Member: SetLeftRightSize -#*------------------------------------------------------------------------ -#* -#* Klasse: ScFunctionWin -#* -#* Funktion: Groesse fuer die einzelnen Controls einstellen, -#* wenn Links oder Rechts angedockt wird. -#* -#* Input: --- -#* -#* Output: --- -#* -#************************************************************************/ - -void ScFunctionWin::SetLeftRightSize() -{ - if(!bSizeFlag) - { - bSizeFlag = true; - - Size aDiffSize=GetSizePixel(); - Size aNewSize=GetOutputSizePixel(); - aDiffSize.Width()-=aNewSize.Width(); - aDiffSize.Height()-=aNewSize.Height(); - - OUString aString("ww"); - Size aTxtSize( aFuncList->GetTextWidth(aString), aFuncList->GetTextHeight() ); - - Range aYRange(3*aTxtSize.Height()+aFuncList->GetPosPixel().Y(), - GetOutputSizePixel().Height()-2*aTxtSize.Height()); - aPrivatSplit->SetYRange(aYRange); - - if(aOldSize.Width()!=aNewSize.Width()) - SetMyWidthLeRi(aNewSize); - - if(aOldSize.Height()!=aNewSize.Height()) - SetMyHeightLeRi(aNewSize); - - aOldSize=aNewSize; - aNewSize.Width()+=aDiffSize.Width(); - aNewSize.Height()+=aDiffSize.Height(); - bSizeFlag=false; - } - -} - -/************************************************************************* -#* Member: SetMyWidthLeRi -#*------------------------------------------------------------------------ -#* -#* Klasse: ScFunctionWin -#* -#* Funktion: Breite fuer die einzelnen Controls und -#* das Fenster einstellen,wenn Li oder Re -#* -#* Input: neue Fenstergroesse -#* -#* Output: --- -#* -#************************************************************************/ - -void ScFunctionWin::SetMyWidthLeRi(Size &aNewSize) -{ - if((sal_uLong)aNewSize.Width()<nMinWidth) aNewSize.Width()=nMinWidth; - - Size aCDSize=aCatBox->GetSizePixel(); - Size aFLSize=aFuncList->GetSizePixel(); - Size aSplitterSize=aPrivatSplit->GetSizePixel(); - Size aFDSize=aFiFuncDesc->GetSizePixel(); - - Point aCDTopLeft=aCatBox->GetPosPixel(); - Point aFLTopLeft=aFuncList->GetPosPixel(); - - aCDSize.Width()=aNewSize.Width()-aCDTopLeft.X()-aFLTopLeft.X(); - aFLSize.Width()=aNewSize.Width()-2*aFLTopLeft.X(); - aFDSize.Width()=aFLSize.Width(); - aSplitterSize.Width()=aFLSize.Width(); - - aCatBox->SetSizePixel(aCDSize); - aFuncList->SetSizePixel(aFLSize); - aPrivatSplit->SetSizePixel(aSplitterSize); - aFiFuncDesc->SetSizePixel(aFDSize); -} - -/************************************************************************* -#* Member: SetHeight -#*------------------------------------------------------------------------ -#* -#* Klasse: ScFunctionWin -#* -#* Funktion: Hoehe fuer die einzelnen Controls und -#* das Fenster einstellen bei Li oder Re -#* -#* Input: neue Fenstergroesse -#* -#* Output: --- -#* -#************************************************************************/ - -void ScFunctionWin::SetMyHeightLeRi(Size &aNewSize) -{ - if((sal_uLong)aNewSize.Height()<nMinHeight) aNewSize.Height()=nMinHeight; - - Size aFLSize=aFuncList->GetSizePixel(); - Size aSplitterSize=aPrivatSplit->GetSizePixel(); - Size aFDSize=aFiFuncDesc->GetSizePixel(); - - Point aFLTopLeft=aFuncList->GetPosPixel(); - Point aSplitterTopLeft=aPrivatSplit->GetPosPixel(); - Point aFDTopLeft=aFiFuncDesc->GetPosPixel(); - - long nTxtHeight = aFuncList->GetTextHeight(); - - short nY=(short)(3*nTxtHeight+ - aFuncList->GetPosPixel().Y()+aSplitterSize.Height()); - - aFDTopLeft.Y()=aNewSize.Height()-aFDSize.Height()-4; - if(nY>aFDTopLeft.Y()) - { - aFDSize.Height()-=nY-aFDTopLeft.Y(); - aFDTopLeft.Y()=nY; - } - aSplitterTopLeft.Y()=aFDTopLeft.Y()-aSplitterSize.Height()-1; - aFLSize.Height()=aSplitterTopLeft.Y()-aFLTopLeft.Y()-1; - - aFuncList->SetSizePixel(aFLSize); - aPrivatSplit->SetPosPixel(aSplitterTopLeft); - aFiFuncDesc->SetPosPixel(aFDTopLeft); - aFiFuncDesc->SetSizePixel(aFDSize); - -} - -/************************************************************************* #* Member: SetDescription #*------------------------------------------------------------------------ #* @@ -372,13 +200,6 @@ void ScFunctionWin::SetDescription() } } -/// override to set new size of the controls -void ScFunctionWin::Resize() -{ - SetSize(); - vcl::Window::Resize(); -} - /************************************************************************* #* Member: UpdateFunctionList #*------------------------------------------------------------------------ @@ -614,66 +435,4 @@ IMPL_LINK_NOARG( ScFunctionWin, SetSelectionHdl, ListBox&, void ) DoEnter(); // Uebernimmt die Eingabe } -/************************************************************************* -#* Handle: SetSplitHdl -#*------------------------------------------------------------------------ -#* -#* Klasse: ScFunctionWin -#* -#* Funktion: Bei einer Aenderung des Split- Controls werden die -#* einzelnen Controls an die neue Groesse angepasst. -#* -#* Input: Zeiger auf Control -#* -#* Output: --- -#* -#************************************************************************/ - -IMPL_LINK( ScFunctionWin, SetSplitHdl, ScPrivatSplit&, rCtrl, void ) -{ - if (&rCtrl == aPrivatSplit.get()) - { - short nDeltaY=aPrivatSplit->GetDeltaY(); - Size aFLSize=aFuncList->GetSizePixel(); - Size aFDSize=aFiFuncDesc->GetSizePixel(); - Point aFDTopLeft=aFiFuncDesc->GetPosPixel(); - - aFLSize.Height()+=nDeltaY; - aFDSize.Height()-=nDeltaY; - aFDTopLeft.Y()+=nDeltaY; - aFuncList->SetSizePixel(aFLSize); - aFiFuncDesc->SetPosPixel(aFDTopLeft); - aFiFuncDesc->SetSizePixel(aFDSize); - } -} - -IMPL_LINK_NOARG(ScFunctionWin, TimerHdl, Idle *, void) -{ - OUString aString("ww"); - Size aTxtSize( aFiFuncDesc->GetTextWidth(aString), aFiFuncDesc->GetTextHeight() ); - Point aTopLeft=aCatBox->GetPosPixel(); - nMinWidth=aTxtSize.Width()+aTopLeft.X() +2*aFuncList->GetPosPixel().X(); - nMinHeight=19*aTxtSize.Height(); - SetSize(); -} - -void ScFunctionWin::UseSplitterInitPos() -{ - if ( IsVisible() && aPrivatSplit->IsEnabled() && aSplitterInitPos != Point() ) - { - aPrivatSplit->MoveSplitTo(aSplitterInitPos); - aSplitterInitPos = Point(); // use only once - } -} - -void ScFunctionWin::StateChanged( StateChangedType nStateChange ) -{ - vcl::Window::StateChanged( nStateChange ); - - if (nStateChange == StateChangedType::InitShow) - { - UseSplitterInitPos(); // set initial splitter position if necessary - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/formdlg/dwfunctr.hrc b/sc/source/ui/formdlg/dwfunctr.hrc index 8b34df8..b025f13 100644 --- a/sc/source/ui/formdlg/dwfunctr.hrc +++ b/sc/source/ui/formdlg/dwfunctr.hrc @@ -21,6 +21,5 @@ #define LB_FUNC 2 #define IMB_INSERT 1 #define FI_FUNCDESC 1 -#define FT_SPLIT 2 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/formdlg/dwfunctr.src b/sc/source/ui/formdlg/dwfunctr.src index 6d6e9b9..8c539e4 100644 --- a/sc/source/ui/formdlg/dwfunctr.src +++ b/sc/source/ui/formdlg/dwfunctr.src @@ -70,11 +70,6 @@ Window FID_FUNCTION_BOX Pos = MAP_APPFONT ( 3 , 115 ) ; Size = MAP_APPFONT ( 72 , 40 ) ; }; - Control FT_SPLIT - { - Pos = MAP_APPFONT ( 3 , 110 ) ; - Size = MAP_APPFONT ( 72 , 3 ) ; - }; ImageButton IMB_INSERT { HelpID = "sc:ImageButton:FID_FUNCTION_BOX:IMB_INSERT"; diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx index 73945d2..7352bb5 100644 --- a/sc/source/ui/inc/dwfunctr.hxx +++ b/sc/source/ui/inc/dwfunctr.hxx @@ -35,18 +35,11 @@ class ScFunctionWin : public vcl::Window { private: - Idle aIdle; - VclPtr<ScPrivatSplit> aPrivatSplit; VclPtr<ListBox> aCatBox; VclPtr<ListBox> aFuncList; VclPtr<ImageButton> aInsertButton; VclPtr<FixedText> aFiFuncDesc; - sal_uLong nMinWidth; - sal_uLong nMinHeight; - Size aOldSize; - bool bSizeFlag; - Point aSplitterInitPos; const ScFuncDesc* pFuncDesc; sal_uInt16 nArgs; @@ -56,27 +49,15 @@ private: void UpdateLRUList(); void DoEnter(); void SetDescription(); - void SetLeftRightSize(); - void SetMyWidthLeRi(Size &aNewSize); - void SetMyHeightLeRi(Size &aNewSize); - void UseSplitterInitPos(); DECL_LINK( SetSelectionHdl, ListBox&, void ); DECL_LINK( SetSelectionClickHdl, Button*, void ); DECL_LINK( SelHdl, ListBox&, void ); - DECL_LINK( SetSplitHdl, ScPrivatSplit&, void ); - DECL_LINK( TimerHdl, Idle*, void ); - -protected: - - virtual void Resize() override; - void SetSize(); - virtual void StateChanged( StateChangedType nStateChange ) override; public: - ScFunctionWin(vcl::Window* pParent, const ResId& rResId); + ScFunctionWin(vcl::Window* pParent, const ResId& rResId); - virtual ~ScFunctionWin() override; + virtual ~ScFunctionWin() override; virtual void dispose() override; void InitLRUList();
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
