include/vcl/salnativewidgets.hxx | 12 ++++ vcl/source/control/edit.cxx | 5 + vcl/source/outdev/nativecontrols.cxx | 13 +++- vcl/source/window/brdwin.cxx | 22 +++++--- vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 21 +++++++ writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 48 +++++++++--------- writerfilter/source/ooxml/OOXMLFastContextHandler.hxx | 48 +++++++++--------- 7 files changed, 108 insertions(+), 61 deletions(-)
New commits: commit cb4276278962c2cbd47d0685881fb2460bf31c70 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Apr 24 16:41:34 2015 +0100 Related: rhbz#1215060 pass std::exceptions through Change-Id: Ifb3431a50f92b95dfc1e851f9584533271e69324 diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index dc18eae..bb72811 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -197,7 +197,7 @@ throw (uno::RuntimeException, xml::sax::SAXException, std::exception) void OOXMLFastContextHandler::lcl_startFastElement (Token_t Element, const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { OOXMLFactory::getInstance()->startAction(this, Element); if( Element == (NMSP_dmlWordDr|XML_positionV) ) @@ -209,7 +209,7 @@ void OOXMLFastContextHandler::lcl_startFastElement void OOXMLFastContextHandler::lcl_endFastElement (Token_t Element) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { OOXMLFactory::getInstance()->endAction(this, Element); } @@ -239,7 +239,7 @@ uno::Reference< xml::sax::XFastContextHandler > OOXMLFastContextHandler::lcl_createFastChildContext (Token_t Element, const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { return OOXMLFactory::getInstance()->createFastChildContext(this, Element); } @@ -264,7 +264,7 @@ void SAL_CALL OOXMLFastContextHandler::characters void OOXMLFastContextHandler::lcl_characters (const OUString & rString) -throw (uno::RuntimeException, xml::sax::SAXException) +throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { if (!m_bDiscardChildren) OOXMLFactory::getInstance()->characters(this, rString); @@ -949,7 +949,7 @@ OOXMLFastContextHandlerProperties::~OOXMLFastContextHandlerProperties() void OOXMLFastContextHandlerProperties::lcl_endFastElement (Token_t Element) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { endAction(Element); @@ -1095,7 +1095,7 @@ OOXMLFastContextHandlerPropertyTable::~OOXMLFastContextHandlerPropertyTable() void OOXMLFastContextHandlerPropertyTable::lcl_endFastElement (Token_t Element) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { OOXMLPropertySet::Pointer_t pPropSet(mpPropertySet->clone()); OOXMLTableImpl::ValuePointer_t pTmpVal @@ -1136,7 +1136,7 @@ OOXMLValue::Pointer_t OOXMLFastContextHandlerValue::getValue() const void OOXMLFastContextHandlerValue::lcl_endFastElement (Token_t Element) -throw (uno::RuntimeException, xml::sax::SAXException) +throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { sendPropertyToParent(); @@ -1207,7 +1207,7 @@ OOXMLFastContextHandlerTable::createFastChildContext void OOXMLFastContextHandlerTable::lcl_endFastElement (Token_t /*Element*/) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { addCurrentChild(); @@ -1253,7 +1253,7 @@ OOXMLFastContextHandlerXNote::~OOXMLFastContextHandlerXNote() void OOXMLFastContextHandlerXNote::lcl_startFastElement (Token_t Element, const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { mbForwardEventsSaved = isForwardEvents(); @@ -1268,7 +1268,7 @@ void OOXMLFastContextHandlerXNote::lcl_startFastElement void OOXMLFastContextHandlerXNote::lcl_endFastElement (Token_t Element) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { endAction(Element); @@ -1477,7 +1477,7 @@ OOXMLFastContextHandlerTextTable::~OOXMLFastContextHandlerTextTable() void OOXMLFastContextHandlerTextTable::lcl_startFastElement (Token_t Element, const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { mpParserState->startTable(); mnTableDepth++; @@ -1496,7 +1496,7 @@ void OOXMLFastContextHandlerTextTable::lcl_startFastElement void OOXMLFastContextHandlerTextTable::lcl_endFastElement (Token_t Element) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { endAction(Element); @@ -1548,7 +1548,7 @@ OOXMLFastContextHandlerShape::~OOXMLFastContextHandlerShape() void OOXMLFastContextHandlerShape::lcl_startFastElement (Token_t Element, const uno::Reference< xml::sax::XFastAttributeList > & Attribs) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { startAction(Element); @@ -1604,7 +1604,7 @@ void OOXMLFastContextHandlerShape::sendShape( Token_t Element ) void OOXMLFastContextHandlerShape::lcl_endFastElement (Token_t Element) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { if (mrShapeContext.is()) { @@ -1633,7 +1633,7 @@ uno::Reference< xml::sax::XFastContextHandler > OOXMLFastContextHandlerShape::lcl_createFastChildContext (Token_t Element, const uno::Reference< xml::sax::XFastAttributeList > & Attribs) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { uno::Reference< xml::sax::XFastContextHandler > xContextHandler; @@ -1705,7 +1705,7 @@ OOXMLFastContextHandlerShape::createUnknownChildContext void OOXMLFastContextHandlerShape::lcl_characters (const OUString & aChars) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { if (mrShapeContext.is()) mrShapeContext->characters(aChars); @@ -1797,7 +1797,7 @@ void OOXMLFastContextHandlerWrapper::addToken( Token_t Token ) void OOXMLFastContextHandlerWrapper::lcl_startFastElement (Token_t Element, const uno::Reference< xml::sax::XFastAttributeList > & Attribs) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { if (mxContext.is()) mxContext->startFastElement(Element, Attribs); @@ -1805,7 +1805,7 @@ void OOXMLFastContextHandlerWrapper::lcl_startFastElement void OOXMLFastContextHandlerWrapper::lcl_endFastElement (Token_t Element) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { if (mxContext.is()) mxContext->endFastElement(Element); @@ -1815,7 +1815,7 @@ uno::Reference< xml::sax::XFastContextHandler > OOXMLFastContextHandlerWrapper::lcl_createFastChildContext (Token_t Element, const uno::Reference< xml::sax::XFastAttributeList > & Attribs) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { uno::Reference< xml::sax::XFastContextHandler > xResult; @@ -1852,7 +1852,7 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext void OOXMLFastContextHandlerWrapper::lcl_characters (const OUString & aChars) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { if (mxContext.is()) mxContext->characters(aChars); @@ -1987,14 +1987,14 @@ OOXMLFastContextHandlerLinear::OOXMLFastContextHandlerLinear(OOXMLFastContextHan void OOXMLFastContextHandlerLinear::lcl_startFastElement(Token_t Element, const uno::Reference< xml::sax::XFastAttributeList >& Attribs) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { buffer.appendOpeningTag( Element, Attribs ); ++depthCount; } void OOXMLFastContextHandlerLinear::lcl_endFastElement(Token_t Element) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { buffer.appendClosingTag( Element ); if( --depthCount == 0 ) @@ -2004,7 +2004,7 @@ void OOXMLFastContextHandlerLinear::lcl_endFastElement(Token_t Element) uno::Reference< xml::sax::XFastContextHandler > OOXMLFastContextHandlerLinear::lcl_createFastChildContext(Token_t, const uno::Reference< xml::sax::XFastAttributeList >&) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { uno::Reference< xml::sax::XFastContextHandler > xContextHandler; xContextHandler.set( this ); @@ -2012,7 +2012,7 @@ OOXMLFastContextHandlerLinear::lcl_createFastChildContext(Token_t, } void OOXMLFastContextHandlerLinear::lcl_characters(const OUString& aChars) - throw (uno::RuntimeException, xml::sax::SAXException) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) { buffer.appendCharacters( aChars ); } diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx index d6e6933..a592dd1 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx @@ -216,16 +216,16 @@ protected: unsigned int mnTableDepth; virtual void lcl_startFastElement(Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) - throw (css::uno::RuntimeException, css::xml::sax::SAXException); + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception); virtual void lcl_endFastElement(Token_t Element) - throw (css::uno::RuntimeException, css::xml::sax::SAXException); + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception); virtual css::uno::Reference< css::xml::sax::XFastContextHandler > lcl_createFastChildContext(Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) - throw (css::uno::RuntimeException, css::xml::sax::SAXException); + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception); virtual void lcl_characters(const OUString & aChars) - throw (css::uno::RuntimeException, css::xml::sax::SAXException); + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception); void startAction(Token_t Element); void endAction(Token_t Element); @@ -301,7 +301,7 @@ protected: OOXMLPropertySet::Pointer_t mpPropertySet; virtual void lcl_endFastElement(Token_t Element) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void setParent(OOXMLFastContextHandler * pParent) SAL_OVERRIDE; private: @@ -320,7 +320,7 @@ protected: OOXMLTableImpl mTable; virtual void lcl_endFastElement(Token_t Element) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; }; class OOXMLFastContextHandlerValue : @@ -335,7 +335,7 @@ public: virtual OOXMLValue::Pointer_t getValue() const SAL_OVERRIDE; virtual void lcl_endFastElement(Token_t Element) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual std::string getType() const SAL_OVERRIDE { return "Value"; } @@ -364,7 +364,7 @@ protected: css::uno::Reference<css::xml::sax::XFastContextHandler> mCurrentChild; virtual void lcl_endFastElement(Token_t Element) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual ResourceEnum_t getResource() const SAL_OVERRIDE { return TABLE; } @@ -391,10 +391,10 @@ private: sal_Int32 mnMyXNoteType; virtual void lcl_startFastElement(Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void lcl_endFastElement(Token_t Element) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual ResourceEnum_t getResource() const SAL_OVERRIDE { return STREAM; } }; @@ -440,10 +440,10 @@ public: protected: virtual void lcl_startFastElement(Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void lcl_endFastElement(Token_t Element) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; }; class OOXMLFastContextHandlerShape: public OOXMLFastContextHandlerProperties @@ -482,16 +482,16 @@ protected: ShapeContextRef mrShapeContext; virtual void lcl_startFastElement(Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void lcl_endFastElement(Token_t Element) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual css::uno::Reference< css::xml::sax::XFastContextHandler > lcl_createFastChildContext (Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void lcl_characters(const OUString & aChars) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; }; @@ -534,16 +534,16 @@ public: protected: virtual void lcl_startFastElement(Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void lcl_endFastElement(Token_t Element) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual css::uno::Reference< css::xml::sax::XFastContextHandler > lcl_createFastChildContext(Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void lcl_characters(const OUString & aChars) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void setId(Id nId) SAL_OVERRIDE; virtual Id getId() const SAL_OVERRIDE; @@ -593,15 +593,15 @@ protected: virtual void process() = 0; virtual void lcl_startFastElement(Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; - virtual void lcl_endFastElement(Token_t Element) throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + virtual void lcl_endFastElement(Token_t Element) throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual css::uno::Reference< css::xml::sax::XFastContextHandler > lcl_createFastChildContext(Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) - throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; - virtual void lcl_characters(const OUString & aChars) throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE; + virtual void lcl_characters(const OUString & aChars) throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; // should be private, but not much point in making deep copies of it oox::formulaimport::XmlStreamBuilder buffer; commit 7deac4656c53965125c9ec1ca6eb8fcc8d393afa Author: Caolán McNamara <caol...@redhat.com> Date: Fri Apr 24 14:59:03 2015 +0100 gtk3: get the right height for Edit boxes smuggle the text height down to the native region calculation code instead of messing around with proxies Change-Id: I727ceddb5b431be82e6e5a725f9bca588e5b2046 diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx index d473aea..1bee876 100644 --- a/include/vcl/salnativewidgets.hxx +++ b/include/vcl/salnativewidgets.hxx @@ -476,6 +476,18 @@ public: bool mbSingleLine:1; }; +/* EditBoxValue: + * + * Value container for editbox specifying additional drawing hints + */ +class VCL_DLLPUBLIC EditBoxValue : public ImplControlValue +{ +public: + EditBoxValue(long nTextHeight) + : ImplControlValue(CTRL_EDITBOX, BUTTONVALUE_DONTKNOW, nTextHeight) + { + } +}; #endif diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 6c73742..c9e19db 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2710,6 +2710,7 @@ void Edit::SetSubEdit( Edit* pEdit ) Size Edit::CalcMinimumSizeForText(const OUString &rString) const { int eCtrlType = ImplGetNativeControlType(); + auto nTextHeight = GetTextHeight(); Size aSize; if (mnWidthInChars != -1) @@ -2726,7 +2727,7 @@ Size Edit::CalcMinimumSizeForText(const OUString &rString) const else aString = rString; - aSize.Height() = GetTextHeight(); + aSize.Height() = nTextHeight; aSize.Width() = GetTextWidth(aString); aSize.Width() += ImplGetExtraOffset() * 2; @@ -2749,7 +2750,7 @@ Size Edit::CalcMinimumSizeForText(const OUString &rString) const aSize = CalcWindowSize( aSize ); // ask NWF what if it has an opinion, too - ImplControlValue aControlValue; + EditBoxValue aControlValue(nTextHeight); Rectangle aRect( Point( 0, 0 ), aSize ); Rectangle aContent, aBound; if( GetNativeControlRegion( diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx index bfb0447..7a8e70f 100644 --- a/vcl/source/outdev/nativecontrols.cxx +++ b/vcl/source/outdev/nativecontrols.cxx @@ -247,9 +247,6 @@ static std::shared_ptr< ImplControlValue > TransformControlValue( const ImplCont aResult.reset( pNew ); } break; - case CTRL_GENERIC: - aResult.reset( new ImplControlValue( rVal ) ); - break; case CTRL_MENU_POPUP: { const MenupopupValue* pMVal = static_cast<const MenupopupValue*>(&rVal); @@ -258,6 +255,16 @@ static std::shared_ptr< ImplControlValue > TransformControlValue( const ImplCont aResult.reset( pNew ); } break; + case CTRL_EDITBOX: + { + auto nTextHeight = rDev.ImplLogicToDevicePixel(Rectangle(0, 0, 0, rVal.getNumericVal())).GetHeight(); + EditBoxValue* pNew = new EditBoxValue(nTextHeight); + aResult.reset(pNew); + } + break; + case CTRL_GENERIC: + aResult.reset( new ImplControlValue( rVal ) ); + break; default: OSL_FAIL( "unknown ImplControlValue type !" ); break; diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 5818d11..e4322e1 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1040,6 +1040,7 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei // for native widget drawing we must find out what // control this border belongs to ControlType aCtrlType = 0; + std::unique_ptr<ImplControlValue> xControlValue(new ImplControlValue()); if (pCtrl) { switch( pCtrl->GetType() ) @@ -1073,7 +1074,13 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei case WINDOW_SPINFIELD: case WINDOW_CALCINPUTLINE: mbNWFBorder = true; - aCtrlType = (pCtrl->GetStyle() & WB_SPIN) ? CTRL_SPINBOX : CTRL_EDITBOX; + if (pCtrl->GetStyle() & WB_SPIN) + aCtrlType = CTRL_SPINBOX; + else + { + aCtrlType = CTRL_EDITBOX; + xControlValue.reset(new EditBoxValue(pWin->GetTextHeight())); + } break; default: break; @@ -1081,12 +1088,11 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei } if( mbNWFBorder ) { - ImplControlValue aControlValue; Rectangle aCtrlRegion( (const Point&)Point(), Size( mnWidth < 10 ? 10 : mnWidth, mnHeight < 10 ? 10 : mnHeight ) ); Rectangle aBounds( aCtrlRegion ); Rectangle aContent( aCtrlRegion ); if( pWin->GetNativeControlRegion( aCtrlType, PART_ENTIRE_CONTROL, aCtrlRegion, - ControlState::ENABLED, aControlValue, OUString(), + ControlState::ENABLED, *xControlValue, OUString(), aBounds, aContent ) ) { mnLeftBorder = aContent.Left() - aBounds.Left(); @@ -1192,7 +1198,7 @@ void ImplSmallBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* ControlType aCtrlType = 0; ControlPart aCtrlPart = PART_ENTIRE_CONTROL; - + std::unique_ptr<ImplControlValue> xControlValue(new ImplControlValue()); if( pWin && (pCtrl = mpBorderWindow->GetWindow( WINDOW_CLIENT )) != NULL ) { switch( pCtrl->GetType() ) @@ -1213,7 +1219,10 @@ void ImplSmallBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* if( pCtrl->GetStyle() & WB_SPIN ) aCtrlType = CTRL_SPINBOX; else + { aCtrlType = CTRL_EDITBOX; + xControlValue.reset(new EditBoxValue(pCtrl->GetTextHeight())); + } break; case WINDOW_LISTBOX: @@ -1258,7 +1267,6 @@ void ImplSmallBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* if ( aCtrlType && pCtrl->IsNativeControlSupported(aCtrlType, aCtrlPart) ) { - ImplControlValue aControlValue; ControlState nState = ControlState::ENABLED; if ( !pWin->IsEnabled() ) @@ -1290,14 +1298,14 @@ void ImplSmallBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* Rectangle aContentRgn( aCtrlRegion ); if( ! ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize && pWin->GetNativeControlRegion( aCtrlType, aCtrlPart, aCtrlRegion, - nState, aControlValue, OUString(), + nState, *xControlValue, OUString(), aBoundingRgn, aContentRgn )) { aCtrlRegion=aContentRgn; } bNativeOK = pWin->DrawNativeControl( aCtrlType, aCtrlPart, aCtrlRegion, nState, - aControlValue, OUString() ); + *xControlValue, OUString() ); // if the native theme draws the spinbuttons in one call, make sure the proper settings // are passed, this might force a redraw though.... (TODO: improve) diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index aba6dd9..9c992ba 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -980,7 +980,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co } bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState, - const ImplControlValue&, const OUString&, + const ImplControlValue& rValue, const OUString&, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) { /* TODO: all this funcions needs improvements */ @@ -1069,6 +1069,25 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar { aEditRect = NWGetComboBoxButtonRect( nType, nPart, rControlRegion ); } + else if (nType == CTRL_EDITBOX) + { + gtk_style_context_save(mpEntryStyle); + gtk_style_context_add_class(mpEntryStyle, GTK_STYLE_CLASS_ENTRY); + + GtkBorder border; + gtk_style_context_get_border(mpEntryStyle, GTK_STATE_FLAG_NORMAL, &border); + + GtkBorder padding; + gtk_style_context_get_padding(mpEntryStyle, GTK_STATE_FLAG_NORMAL, &padding); + + auto nTextHeight = rValue.getNumericVal(); + + gint nWidgetHeight = nTextHeight + padding.top + padding.bottom + border.top + border.bottom; + + aEditRect = Rectangle(rControlRegion.TopLeft(), Size(rControlRegion.GetWidth(), nWidgetHeight)); + + gtk_style_context_restore(mpEntryStyle); + } else { return false;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits