Rebased ref, commits from common ancestor: commit a3953fee8bd0f5c76dbea08fbfc53df936863893 Author: Douglas Mencken <dougmenc...@gmail.com> Date: Mon Apr 4 20:58:01 2016 -0400
vcl.osx: make panes of tabs look Jaguarish plus turn off excessive borders for elements of interface Change-Id: Ief2718eafc8b6a8a12d281ad2988ace0977d9741 diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index 2c3ce4d..7e0e40d 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -490,8 +490,10 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, aComboInfo.value = kThemeButtonOn; aComboInfo.adornment = kThemeAdornmentNone; +# if ( MACOSX_SDK_VERSION > 1060 ) if( nState & ControlState::FOCUSED ) aComboInfo.adornment |= kThemeAdornmentFocus; +# endif HIThemeDrawButton(&rc, &aComboInfo, mrContext, kHIThemeOrientationNormal,&rc); bOK = true; @@ -667,8 +669,10 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, aPushInfo.adornment = ( nState & ControlState::DEFAULT ) ? kThemeAdornmentDefault : kThemeAdornmentNone; +# if ( MACOSX_SDK_VERSION > 1060 ) if( nState & ControlState::FOCUSED ) aPushInfo.adornment |= kThemeAdornmentFocus; +# endif HIThemeDrawButton( &rc, &aPushInfo, mrContext, kHIThemeOrientationNormal, nullptr ); bOK = true; @@ -696,11 +700,14 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, ButtonValue aButtonValue = aValue.getTristateVal(); aInfo.value = ImplGetButtonValue( aButtonValue ); - aInfo.adornment = ( nState & ControlState::DEFAULT ) ? - kThemeAdornmentDefault : - kThemeAdornmentNone; + aInfo.adornment = ( nState & ControlState::DEFAULT ) ? kThemeAdornmentDefault : kThemeAdornmentNone; +# if ( MACOSX_SDK_VERSION > 1060 ) if( nState & ControlState::FOCUSED ) aInfo.adornment |= kThemeAdornmentFocus; +# else + rc.origin.y -= 1; +# endif + HIThemeDrawButton( &rc, &aInfo, mrContext, kHIThemeOrientationNormal, nullptr ); bOK = true; } @@ -881,20 +888,28 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, case ControlType::TabPane: { HIThemeTabPaneDrawInfo aTabPaneDrawInfo; - aTabPaneDrawInfo.version = 1; +# if ( MACOSX_SDK_VERSION <= 1060 ) + aTabPaneDrawInfo.version = 0; // 0 for Jaguar-era tabs +# else + aTabPaneDrawInfo.version = 1; // 1 for "modern" tabs +# endif aTabPaneDrawInfo.state = kThemeStateActive; - aTabPaneDrawInfo.direction=kThemeTabNorth; - aTabPaneDrawInfo.size=kHIThemeTabSizeNormal; - aTabPaneDrawInfo.kind=kHIThemeTabKindNormal; - - //the border is outside the rect rc for Carbon - //but for VCL it should be inside - rc.origin.x+=1; - rc.origin.y-=TAB_HEIGHT_NORMAL/2; - rc.size.height+=TAB_HEIGHT_NORMAL/2; - rc.size.width-=2; + aTabPaneDrawInfo.direction = kThemeTabNorth; + aTabPaneDrawInfo.size = kHIThemeTabSizeNormal; + aTabPaneDrawInfo.kind = kHIThemeTabKindNormal; + aTabPaneDrawInfo.adornment = kThemeAdornmentNone; + + // the border is outside the rect rc for Carbon + // but for VCL it is inside + rc.origin.x += 1; + rc.size.width -= 2; + if ( aTabPaneDrawInfo.version == 1 ) + { + rc.origin.y -= TAB_HEIGHT_NORMAL >> 1; + rc.size.height += TAB_HEIGHT_NORMAL >> 1; + } - HIThemeDrawTabPane(&rc, &aTabPaneDrawInfo, mrContext, kHIThemeOrientationNormal); + HIThemeDrawTabPane( &rc, &aTabPaneDrawInfo, mrContext, kHIThemeOrientationNormal ); bOK = true; } @@ -903,52 +918,66 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, case ControlType::TabItem: { HIThemeTabDrawInfo aTabItemDrawInfo; - aTabItemDrawInfo.version=1; - aTabItemDrawInfo.style=kThemeTabNonFront; - aTabItemDrawInfo.direction=kThemeTabNorth; - aTabItemDrawInfo.size=kHIThemeTabSizeNormal; - aTabItemDrawInfo.adornment=kHIThemeTabAdornmentTrailingSeparator; - //State - if(nState & ControlState::SELECTED) { - aTabItemDrawInfo.style=kThemeTabFront; +# if ( MACOSX_SDK_VERSION <= 1060 ) + aTabItemDrawInfo.version = 0; // 0 for Jaguar-era tabs +# else + aTabItemDrawInfo.version = 1; // 1 for "modern" tabs +# endif + aTabItemDrawInfo.direction = kThemeTabNorth; + aTabItemDrawInfo.size = kHIThemeTabSizeNormal; + aTabItemDrawInfo.style = kThemeTabNonFront; + + if( nState & ControlState::SELECTED ) { + aTabItemDrawInfo.style = kThemeTabFront; } - if(nState & ControlState::FOCUSED) { - aTabItemDrawInfo.adornment|=kHIThemeTabAdornmentFocus; +# if ( MACOSX_SDK_VERSION > 1060 ) + aTabItemDrawInfo.adornment = kHIThemeTabAdornmentTrailingSeparator; + if( nState & ControlState::FOCUSED ) { + aTabItemDrawInfo.adornment |= kHIThemeTabAdornmentFocus; } - - //first, last or middle tab - aTabItemDrawInfo.position=kHIThemeTabPositionMiddle; - - TabitemValue const * pTabValue = static_cast<TabitemValue const *>(&aValue); - TabitemFlags nAlignment = pTabValue->mnAlignment; - //TabitemFlags::LeftAligned (and TabitemFlags::RightAligned) for the leftmost (or rightmost) tab - //when there are several lines of tabs because there is only one first tab and one - //last tab and TabitemFlags::FirstInGroup (and TabitemFlags::LastInGroup) because when the - //line width is different from window width, there may not be TabitemFlags::RightAligned - if( ( (nAlignment & TabitemFlags::LeftAligned)&&(nAlignment & TabitemFlags::RightAligned) ) || - ( (nAlignment & TabitemFlags::FirstInGroup)&&(nAlignment & TabitemFlags::LastInGroup) ) - ) //tab alone - aTabItemDrawInfo.position=kHIThemeTabPositionOnly; - else if((nAlignment & TabitemFlags::LeftAligned)||(nAlignment & TabitemFlags::FirstInGroup)) - aTabItemDrawInfo.position=kHIThemeTabPositionFirst; - else if((nAlignment & TabitemFlags::RightAligned)||(nAlignment & TabitemFlags::LastInGroup)) - aTabItemDrawInfo.position=kHIThemeTabPositionLast; - - //support for RTL - //see issue 79748 - if( AllSettings::GetLayoutRTL() ) { - if( aTabItemDrawInfo.position == kHIThemeTabPositionFirst ) - aTabItemDrawInfo.position = kHIThemeTabPositionLast; - else if( aTabItemDrawInfo.position == kHIThemeTabPositionLast ) +# else + aTabItemDrawInfo.adornment = kThemeAdornmentNone; +# endif + + // by default it is tab somewhere in the middle + aTabItemDrawInfo.position = kHIThemeTabPositionMiddle; + + if ( aTabItemDrawInfo.version == 1 ) { + TabitemValue const * pTabValue = static_cast<TabitemValue const *>(&aValue); + TabitemFlags nAlignment = pTabValue->mnAlignment; + //TabitemFlags::LeftAligned (and TabitemFlags::RightAligned) for the leftmost (or rightmost) tab + //when there are several lines of tabs because there is only one first tab and one + //last tab and TabitemFlags::FirstInGroup (and TabitemFlags::LastInGroup) because when the + //line width is different from window width, there may not be TabitemFlags::RightAligned + if( ( (nAlignment & TabitemFlags::LeftAligned)&&(nAlignment & TabitemFlags::RightAligned) ) || + ( (nAlignment & TabitemFlags::FirstInGroup)&&(nAlignment & TabitemFlags::LastInGroup) ) + ) // tab alone + aTabItemDrawInfo.position = kHIThemeTabPositionOnly; + else if((nAlignment & TabitemFlags::LeftAligned)||(nAlignment & TabitemFlags::FirstInGroup)) + aTabItemDrawInfo.position = kHIThemeTabPositionFirst; + else if((nAlignment & TabitemFlags::RightAligned)||(nAlignment & TabitemFlags::LastInGroup)) + aTabItemDrawInfo.position = kHIThemeTabPositionLast; + + //support for RTL + //see issue 79748 + if( AllSettings::GetLayoutRTL() ) { + if( aTabItemDrawInfo.position == kHIThemeTabPositionFirst ) + aTabItemDrawInfo.position = kHIThemeTabPositionLast; + else if( aTabItemDrawInfo.position == kHIThemeTabPositionLast ) aTabItemDrawInfo.position = kHIThemeTabPositionFirst; + } } - rc.size.width+=2;//because VCL has 2 empty pixels between 2 tabs - rc.origin.x-=1; + rc.origin.x -= 1; + if ( aTabItemDrawInfo.version == 0 ) { + rc.origin.y += 2; + } else { + rc.size.width += 2; // because VCL has 2 empty pixels between 2 tabs + } - HIThemeDrawTab(&rc, &aTabItemDrawInfo, mrContext, kHIThemeOrientationNormal, &rc ); + HIThemeDrawTab( &rc, &aTabItemDrawInfo, mrContext, kHIThemeOrientationNormal, &rc ); - bOK=true; + bOK = true; } break; @@ -965,8 +994,10 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, aListInfo.value = kThemeButtonOn; aListInfo.adornment = kThemeAdornmentDefault; +# if ( MACOSX_SDK_VERSION > 1060 ) if( nState & ControlState::FOCUSED ) aListInfo.adornment |= kThemeAdornmentFocus; +# endif HIThemeDrawButton(&rc, &aListInfo, mrContext, kHIThemeOrientationNormal,&rc); bOK = true; @@ -984,7 +1015,9 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, rc.size.height+=1; HIThemeDrawFrame(&rc, &aTextDrawInfo, mrContext, kHIThemeOrientationNormal); +# if ( MACOSX_SDK_VERSION > 1060 ) if(nState & ControlState::FOCUSED) HIThemeDrawFocusRect(&rc, true, mrContext, kHIThemeOrientationNormal); +# endif bOK=true; break; @@ -1014,7 +1047,9 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, HIThemeDrawFrame(&rc, &aTextDrawInfo, mrContext, kHIThemeOrientationNormal); +# if ( MACOSX_SDK_VERSION > 1060 ) if(nState & ControlState::FOCUSED) HIThemeDrawFocusRect(&rc, true, mrContext, kHIThemeOrientationNormal); +# endif bOK=true; } @@ -1043,7 +1078,9 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, HIThemeDrawFrame(&rc, &aTextDrawInfo, mrContext, kHIThemeOrientationNormal); +# if ( MACOSX_SDK_VERSION > 1060 ) if(nState & ControlState::FOCUSED) HIThemeDrawFocusRect(&rc, true, mrContext, kHIThemeOrientationNormal); +# endif //buttons: const SpinbuttonValue* pSpinButtonVal = (aValue.getType() == ControlType::SpinButtons) ? static_cast<const SpinbuttonValue*>(&aValue) : nullptr; @@ -1091,8 +1128,10 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, (nLowerState & ControlState::DEFAULT) ) ? kThemeAdornmentDefault : kThemeAdornmentNone; +# if ( MACOSX_SDK_VERSION > 1060 ) if( (nUpperState & ControlState::FOCUSED) || (nLowerState & ControlState::FOCUSED)) aSpinInfo.adornment |= kThemeAdornmentFocus; +# endif HIThemeDrawButton( &buttonRc, &aSpinInfo, mrContext, kHIThemeOrientationNormal, nullptr ); } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index ee31141..fb39272 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -359,164 +359,185 @@ namespace MinimumRaggednessWrap bool TabControl::ImplPlaceTabs( long nWidth ) { - if ( nWidth <= 0 ) - return false; if ( mpTabCtrlData->maItemList.empty() ) return false; - long nMaxWidth = nWidth; + long origWidth = nWidth; + nWidth -= 16; + if ( nWidth <= 0 ) + return false; const long nOffsetX = 2 + GetItemsOffset().X(); const long nOffsetY = 2 + GetItemsOffset().Y(); - //fdo#66435 throw Knuth/Tex minimum raggedness algorithm at the problem - //of ugly bare tabs on lines of their own + // fdo#66435 throw Knuth/Tex minimum raggedness algorithm at the problem + // of single bare tab on lines of their own - //collect widths - std::vector<sal_Int32> aWidths; + // collect widths + std::vector< sal_Int32 > aWidths; for( std::vector<ImplTabItem>::iterator it = mpTabCtrlData->maItemList.begin(); it != mpTabCtrlData->maItemList.end(); ++it ) { - aWidths.push_back(ImplGetItemSize( &(*it), nMaxWidth ).Width()); + aWidths.push_back( ImplGetItemSize( &(*it), nWidth ).Width() ); } - //aBreakIndexes will contain the indexes of the last tab on each row - std::deque<size_t> aBreakIndexes(MinimumRaggednessWrap::GetEndOfLineIndexes(aWidths, nMaxWidth - nOffsetX - 2)); + // fill aBreakIndexes with indexes of the last tab on each row + long lineW = nWidth - nOffsetX - 2; + std::deque< size_t > aBreakIndexes( MinimumRaggednessWrap::GetEndOfLineIndexes( aWidths, lineW ) ); - if ( (mnMaxPageWidth > 0) && (mnMaxPageWidth < nMaxWidth) ) - nMaxWidth = mnMaxPageWidth; - nMaxWidth -= GetItemsOffset().X(); + if ( ( mnMaxPageWidth > 0 ) && ( mnMaxPageWidth < nWidth ) ) + nWidth = mnMaxPageWidth; - long nX = nOffsetX; - long nY = nOffsetY; + nWidth -= GetItemsOffset().X(); - sal_uInt16 nLines = 0; - sal_uInt16 nCurLine = 0; + const size_t magicMaxLines = 100; // magic number of maximum lines - long nLineWidthAry[100]; - sal_uInt16 nLinePosAry[101]; - nLineWidthAry[0] = 0; - nLinePosAry[0] = 0; + long maxLineWidth = 0; + long nLineWidths[ magicMaxLines ]; + nLineWidths[ 0 ] = 0; + sal_uInt16 nLineFirstTabNums[ magicMaxLines + 1 ]; + nLineFirstTabNums[ 0 ] = 0; - size_t nIndex = 0; - sal_uInt16 nPos = 0; + long nX = nOffsetX; + long nY = nOffsetY; - for( std::vector<ImplTabItem>::iterator it = mpTabCtrlData->maItemList.begin(); - it != mpTabCtrlData->maItemList.end(); ++it, ++nIndex ) - { - Size aSize = ImplGetItemSize( &(*it), nMaxWidth ); + sal_uInt16 nLines = 0; // number of lines + sal_uInt16 nChosenLine = 0; // line which is active now + sal_uInt16 nIndex = 0; + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin() ; + it != mpTabCtrlData->maItemList.end() ; + ++it, ++nIndex ) + { bool bNewLine = false; - if (!aBreakIndexes.empty() && nIndex > aBreakIndexes.front()) + if ( !aBreakIndexes.empty() && nIndex > aBreakIndexes.front() ) { aBreakIndexes.pop_front(); - bNewLine = true; + bNewLine = true; // this tab is on new line } - if ( bNewLine && (nWidth > 2+nOffsetX) ) + Size aSize = ImplGetItemSize( &(*it), nWidth ); + + if ( bNewLine && ( nWidth > 2 + nOffsetX ) ) { - if ( nLines == 99 ) + nLines++; + if ( nLines == magicMaxLines ) break; nX = nOffsetX; nY += aSize.Height(); - nLines++; - nLineWidthAry[nLines] = 0; - nLinePosAry[nLines] = nPos; + + nLineWidths[ nLines ] = 0; + nLineFirstTabNums[ nLines ] = nIndex; } Rectangle aNewRect( Point( nX, nY ), aSize ); - if ( mbSmallInvalidate && (it->maRect != aNewRect) ) + if ( mbSmallInvalidate && ( it->maRect != aNewRect ) ) mbSmallInvalidate = false; it->maRect = aNewRect; it->mnLine = nLines; it->mbFullVisible = true; - nLineWidthAry[nLines] += aSize.Width(); + nLineWidths[ nLines ] += aSize.Width(); + if ( ( !maxLineWidth ) || ( nLineWidths[ nLines ] > maxLineWidth ) ) + maxLineWidth = nLineWidths[ nLines ]; + nX += aSize.Width(); if ( it->mnId == mnCurPageId ) - nCurLine = nLines; - - nPos++; + nChosenLine = nLines; } + nLineFirstTabNums[ nLines + 1 ] = static_cast< sal_uInt16 >( mpTabCtrlData->maItemList.size() ); + + const long firstTabXWhenAlignedLeft = 1 + ( ( origWidth - nWidth ) >> 1 ); + if ( nLines ) - { // two or more lines - long nLineHeightAry[100]; - long nIH = mpTabCtrlData->maItemList[0].maRect.Bottom()-2; + { // two or more lines + const long tabHeight = mpTabCtrlData->maItemList[0].maRect.Bottom() - 2; + long nLineHeights[ nLines + 1 ]; - for ( sal_uInt16 i = 0; i < nLines+1; i++ ) + for ( sal_uInt16 line = 0; line < nLines + 1; line++ ) { - if ( i <= nCurLine ) - nLineHeightAry[i] = nIH*(nLines-(nCurLine-i)) + GetItemsOffset().Y(); + if ( line <= nChosenLine ) + nLineHeights[ line ] = tabHeight * ( nLines - ( nChosenLine - line ) ) + GetItemsOffset().Y(); else - nLineHeightAry[i] = nIH*(i-nCurLine-1) + GetItemsOffset().Y(); + nLineHeights[ line ] = tabHeight * ( line - nChosenLine - 1 ) + GetItemsOffset().Y(); } - nLinePosAry[nLines+1] = (sal_uInt16)mpTabCtrlData->maItemList.size(); - - long nDX = 0; - long nModDX = 0; - long nIDX = 0; + sal_uInt32 item = 0; + sal_uInt16 lineN = 0; + bool bNewLine = false; + long lastX = firstTabXWhenAlignedLeft; - sal_uInt16 i = 0; - sal_uInt16 n = 0; for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); - it != mpTabCtrlData->maItemList.end(); ++it ) + it != mpTabCtrlData->maItemList.end(); ++it, item++ ) { - if ( i == nLinePosAry[n] ) + if ( item == nLineFirstTabNums[ lineN ] ) { - if ( n == nLines+1 ) + if ( lineN == nLines + 1 ) break; - nIDX = 0; - if( nLinePosAry[n+1]-i > 0 ) - { - nDX = ( nWidth - nOffsetX - nLineWidthAry[n] ) / ( nLinePosAry[n+1] - i ); - nModDX = ( nWidth - nOffsetX - nLineWidthAry[n] ) % ( nLinePosAry[n+1] - i ); - } - else - { - // FIXME: this is a case of tabctrl way too small - nDX = 0; - nModDX = 0; - } - n++; + lineN++; + bNewLine = true; } - it->maRect.Left() += nIDX; - it->maRect.Right() += nIDX + nDX; - it->maRect.Top() = nLineHeightAry[n-1]; - it->maRect.Bottom() = nLineHeightAry[n-1] + nIH; - nIDX += nDX; + it->maRect.Top() = nLineHeights[ lineN - 1 ]; + it->maRect.Bottom() = nLineHeights[ lineN - 1 ] + tabHeight; - if ( nModDX ) + long lastTabOnPreviousLine = 0; + if ( lineN > 0 ) + lastTabOnPreviousLine = nLineFirstTabNums[ lineN - 1 ]; + long itemsInRow = nLineFirstTabNums[ lineN ] - lastTabOnPreviousLine; + + it->maRect.Right() += firstTabXWhenAlignedLeft; + + if( ImplGetSVData()->maNWFData.mbCenteredTabs ) { - nIDX++; - it->maRect.Right()++; - nModDX--; + long nDeltaWidth = 0; + long nModDW = 0; + if ( maxLineWidth > nLineWidths[ lineN ] ) + { + nDeltaWidth = ( maxLineWidth - nLineWidths[ lineN ] ) / itemsInRow; + nModDW = ( maxLineWidth - nLineWidths[ lineN ] ) % itemsInRow; + } + if ( nDeltaWidth > 0 ) + it->maRect.Right() += nDeltaWidth; + if ( nModDW > 0 ) + it->maRect.Right() += ( nModDW >> 1 ); } - i++; + if ( bNewLine ) + { + lastX = firstTabXWhenAlignedLeft; + bNewLine = false; + } + it->maRect.Left() = lastX; + lastX = it->maRect.Right(); } } else - { // only one line - if(ImplGetSVData()->maNWFData.mbCenteredTabs) - { - int nRightSpace = nMaxWidth;//space left on the right by the tabs - for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); - it != mpTabCtrlData->maItemList.end(); ++it ) - { - nRightSpace -= it->maRect.Right()-it->maRect.Left(); - } + { // only one line + long firstTabX = firstTabXWhenAlignedLeft; + + if( ImplGetSVData()->maNWFData.mbCenteredTabs ) + { // place them into the middle + long spaceLeft = nWidth; // space left after tabs for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); it != mpTabCtrlData->maItemList.end(); ++it ) { - it->maRect.Left() += nRightSpace / 2; - it->maRect.Right() += nRightSpace / 2; + spaceLeft -= it->maRect.Right() - it->maRect.Left(); } + firstTabX += ( 1 + spaceLeft ) >> 1; + } + + long lastX = firstTabX; + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) + { + it->maRect.Left() = lastX; + it->maRect.Right() += firstTabX; + lastX = it->maRect.Right(); } } @@ -525,59 +546,63 @@ bool TabControl::ImplPlaceTabs( long nWidth ) Rectangle TabControl::ImplGetTabRect( sal_uInt16 nItemPos, long nWidth, long nHeight ) { - Size aWinSize = Control::GetOutputSizePixel(); - if ( nWidth < 0 ) - nWidth = aWinSize.Width(); - if ( nHeight < 0 ) - nHeight = aWinSize.Height(); - if ( mpTabCtrlData->maItemList.empty() ) { - long nW = nWidth-TAB_OFFSET*2; - long nH = nHeight-TAB_OFFSET*2; - return (nW > 0 && nH > 0) - ? Rectangle( Point( TAB_OFFSET, TAB_OFFSET ), Size( nW, nH ) ) - : Rectangle(); + long nW = nWidth - TAB_OFFSET * 2; + long nH = nHeight - TAB_OFFSET * 2; + return ( nW > 0 && nH > 0 ) + ? Rectangle( Point( TAB_OFFSET, TAB_OFFSET ), Size( nW, nH ) ) + : Rectangle(); + } + + if ( ( nWidth < 0 ) || ( nHeight < 0 ) ) { + Size aWinSize = Control::GetOutputSizePixel(); + if ( nWidth < 0 ) + nWidth = aWinSize.Width(); + if ( nHeight < 0 ) + nHeight = aWinSize.Height(); } if ( nItemPos == TAB_PAGERECT ) { - sal_uInt16 nLastPos; + sal_uInt16 nCurPagePos = 0; if ( mnCurPageId ) - nLastPos = GetPagePos( mnCurPageId ); - else - nLastPos = 0; - - Rectangle aRect = ImplGetTabRect( nLastPos, nWidth, nHeight ); - long nW = nWidth-TAB_OFFSET*2; - long nH = nHeight-aRect.Bottom()-TAB_OFFSET*2; - aRect = (nW > 0 && nH > 0) - ? Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ), Size( nW, nH ) ) - : Rectangle(); + nCurPagePos = GetPagePos( mnCurPageId ); + + Rectangle aRect = ImplGetTabRect( nCurPagePos, nWidth, nHeight ); + long nW = nWidth; + long nH = nHeight - aRect.Bottom(); + nW -= TAB_OFFSET * 2; + nH -= TAB_OFFSET * 2; + aRect = ( nW > 0 && nH > 0 ) + ? Rectangle( Point( TAB_OFFSET, aRect.Bottom() + TAB_OFFSET ), Size( nW, nH ) ) + : Rectangle(); return aRect; } nWidth -= 1; - if ( (nWidth <= 0) || (nHeight <= 0) ) + if ( ( nWidth <= 0 ) || ( nHeight <= 0 ) ) return Rectangle(); - if ( mbFormat || (mnLastWidth != nWidth) || (mnLastHeight != nHeight) ) + if ( mbFormat || ( mnLastWidth != nWidth ) || ( mnLastHeight != nHeight ) ) { - vcl::Font aFont( GetFont() ); - aFont.SetTransparent( true ); - SetFont( aFont ); + ///vcl::Font aFont( GetFont() ); + ///aFont.SetTransparent( true ); + ///SetFont( aFont ); + // calculate offsets & sizes for each tab bool bRet = ImplPlaceTabs( nWidth ); if ( !bRet ) return Rectangle(); - mnLastWidth = nWidth; - mnLastHeight = nHeight; - mbFormat = false; + mnLastWidth = nWidth; + mnLastHeight = nHeight; + mbFormat = false; } - return size_t(nItemPos) < mpTabCtrlData->maItemList.size() ? mpTabCtrlData->maItemList[nItemPos].maRect : Rectangle(); + return static_cast< size_t >( nItemPos ) < mpTabCtrlData->maItemList.size() + ? mpTabCtrlData->maItemList[ nItemPos ].maRect : Rectangle(); } void TabControl::ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId ) @@ -1612,10 +1637,11 @@ void TabControl::SetTabPageSizePixel( const Size& rSize ) ImplFreeLayoutData(); Size aNewSize( rSize ); - aNewSize.Width() += TAB_OFFSET*2; - Rectangle aRect = ImplGetTabRect( TAB_PAGERECT, - aNewSize.Width(), aNewSize.Height() ); - aNewSize.Height() += aRect.Top()+TAB_OFFSET; + + aNewSize.Width() += TAB_OFFSET + TAB_OFFSET; + Rectangle aRect = ImplGetTabRect( TAB_PAGERECT, aNewSize.Width(), aNewSize.Height() ); + aNewSize.Height() += aRect.Top() + TAB_OFFSET; + Window::SetOutputSizePixel( aNewSize ); } commit acedb29bee11900296f11625f5d9c57d6d20fef1 Author: Douglas Mencken <dougmenc...@gmail.com> Date: Fri Dec 11 15:15:41 2015 -0500 deal with some math functions and std:: namespace look at these commits~ 4340cc7a63c3a94a7b95e014a501b44d886e18bb 966fbbc78f0a154bb3f21506cf882b972c3652df cc906ec47eaaad247e8fbed5c9e6f3604a8b64c7 36ae1972ff64c80dc053680c82032904f7bbdcb8 7cc8e0c302a5e7b669778337576a37f34754478c Change-Id: I07f913b7931fdb433a5e2e195babc8024176ebac diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index 3db5cb2..41ae57f 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -30,7 +30,7 @@ #include <cmath> #include <numeric> -#if defined(ANDROID) +#if defined(ANDROID) || ( defined(__APPLE__) && (defined(__POWERPC__) || defined(__ppc__)) ) namespace std { template<typename T> diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 8040594..37511e3 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -25,6 +25,7 @@ #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> #include <basegfx/polygon/b2dlinegeometry.hxx> +#include <boost/math/special_functions/next.hpp> #include <com/sun/star/drawing/LineCap.hpp> #include <comphelper/random.hxx> @@ -210,7 +211,7 @@ namespace drawinglayer { double getRandomColorRange() { - return comphelper::rng::uniform_real_distribution(0.0, nextafter(1.0, DBL_MAX)); + return comphelper::rng::uniform_real_distribution(0.0, boost::math::nextafter(1.0, DBL_MAX)); } } diff --git a/external/libzmf/0001-add-missing-include.patch.1 b/external/libzmf/0001-add-missing-include.patch.1 index d640531..b4fb859 100644 --- a/external/libzmf/0001-add-missing-include.patch.1 +++ b/external/libzmf/0001-add-missing-include.patch.1 @@ -18,7 +18,7 @@ index ded93c7..7e024b3 100644 +#include <cmath> + -+#if defined(__ANDROID__) ++#if defined(__ANDROID__) || ( defined(__APPLE__) && (defined(__POWERPC__) || defined(__ppc__)) ) +namespace std +{ +template<typename T> diff --git a/include/comphelper/random.hxx b/include/comphelper/random.hxx index 218d616..c54acc6 100644 --- a/include/comphelper/random.hxx +++ b/include/comphelper/random.hxx @@ -22,7 +22,7 @@ namespace rng // variable: If it is set, use a fixed seed. // note that uniform_int_distribution is inclusive of b, i.e. [a,b] while -// uniform_real_distribution is exclusive of b, i.e. [a,b), std::nextafter may be your friend there +// uniform_real_distribution is exclusive of b, i.e. [a,b), [std/boost]::nextafter may be your friend there /// uniform distribution in [a,b) COMPHELPER_DLLPUBLIC double uniform_real_distribution(double a = 0.0, double b = 1.0); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index a8627c0..b508a69 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -38,7 +38,7 @@ #include <thread> #include <comphelper/threadpool.hxx> -#if defined(ANDROID) +#if defined(ANDROID) || ( defined(__APPLE__) && (defined(__POWERPC__) || defined(__ppc__)) ) namespace std { template<typename T> diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 4b000b59..86c0675 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -34,6 +34,7 @@ #include <tools/rcid.h> #include <algorithm> #include <cmath> +#include <boost/math/special_functions/next.hpp> #define ADDIN_SERVICE "com.sun.star.sheet.AddIn" #define MY_SERVICE "com.sun.star.sheet.addin.Analysis" @@ -697,7 +698,7 @@ double SAL_CALL AnalysisAddIn::getRandbetween( double fMin, double fMax ) throw( if( fMin > fMax ) throw lang::IllegalArgumentException(); - double fRet = floor(comphelper::rng::uniform_real_distribution(fMin, nextafter(fMax+1, -DBL_MAX))); + double fRet = floor(comphelper::rng::uniform_real_distribution(fMin, boost::math::nextafter(fMax+1, -DBL_MAX))); RETURN_FINITE( fRet ); } diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx index e28b17f..3d40c2e 100644 --- a/slideshow/source/engine/opengl/TransitionImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionImpl.cxx @@ -35,6 +35,7 @@ #include <array> #include <utility> +#include <boost/math/special_functions/next.hpp> #include <comphelper/random.hxx> #include "TransitionImpl.hxx" @@ -926,7 +927,7 @@ std::shared_ptr<OGLTransitionImpl> makeRochade() inline double randFromNeg1to1() { - return comphelper::rng::uniform_real_distribution(-1.0, std::nextafter(1.0, DBL_MAX)); + return comphelper::rng::uniform_real_distribution(-1.0, boost::math::nextafter(1.0, DBL_MAX)); } // TODO(Q3): extract to basegfx diff --git a/vcl/source/filter/sgvspln.cxx b/vcl/source/filter/sgvspln.cxx index fae580e..1a2d817 100644 --- a/vcl/source/filter/sgvspln.cxx +++ b/vcl/source/filter/sgvspln.cxx @@ -24,7 +24,7 @@ #include <sgvspln.hxx> #include <cmath> -#if defined(ANDROID) +#if defined(ANDROID) || ( defined(__APPLE__) && (defined(__POWERPC__) || defined(__ppc__)) ) namespace std { template<typename T> diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 3451478..f333469 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -27,7 +27,7 @@ #include <salgdi.hxx> #include <unicode/uchar.h> -#if defined(ANDROID) +#if defined(ANDROID) || ( defined( __APPLE__ ) && ( defined( __POWERPC__ ) || defined( __ppc__ ) ) ) namespace std { template<typename T> diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 40e2e7d..b316c4f 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -56,7 +56,17 @@ #include "opengl/framebuffer.hxx" #include <vcl/opengl/OpenGLHelper.hxx> #endif -#include <rtl/math.hxx> + +#if defined(__APPLE__) && ( defined(__POWERPC__) || defined(__ppc__) ) +namespace std +{ +template< typename T > +T nextafter( T from, T to ) +{ + return ::nextafter( from, to ); +} +} +#endif #define FIXME_SELF_INTERSECTING_WORKING 0 #define FIXME_BOUNCE_BUTTON 0 diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index fa05c83..1f042a7 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -41,7 +41,7 @@ using namespace com::sun::star; -#if defined(ANDROID) +#if defined(ANDROID) || ( defined(__APPLE__) && (defined(__POWERPC__) || defined(__ppc__)) ) namespace std { template<typename T> commit 8a58152a7265ebdddbb85ecbd8d3c8610b6b1ca9 Author: Douglas Mencken <dougmenc...@gmail.com> Date: Sun Jan 8 15:04:12 2017 -0500 make the include of OpenGLHelper.hxx not global here surround it like in pieces of code which actually uses it Change-Id: Iac993553455248a2d2f999f857b781dbdb37acf5 diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 2dd9925..3451478 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -19,7 +19,6 @@ #include "CommonSalLayout.hxx" -#include <vcl/opengl/OpenGLHelper.hxx> #include <vcl/unohelp.hxx> #include <scrptrun.h> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> @@ -39,6 +38,10 @@ T lround(T x) } #endif +#ifdef _WIN32 +# include <vcl/opengl/OpenGLHelper.hxx> +#endif + static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pUserData) { commit bcb519baf76c53c1c013782d110b22315d40d9cb Author: Douglas Mencken <dougmenc...@gmail.com> Date: Sat Jan 7 23:14:41 2017 -0500 adapt recent changes in vcl.fonts for Leopard the kCTFontFormatAttribute is absent in 10.5 since commit 48304cb5b4d8df71463837e2e48aa7c4d9594df9 use CGContextShowGlyphsAtPositions equivalent to CTFontDrawGlyphs introduced in 10.7 try to look at commits~ first f099f3d3bd1203045ef5f3d0b448f72c00f2fe1e then 3a304a4e75d21fff5ba4775d9cb93b17f998e7ef & then 3a64e01a7e2ac65daa4f3fa623d9ef5b9ca24f7f ( Library_vcl.mk ) CommonSalLayout goes to add_objcxxflags_exception_objects Change-Id: I719e614b7dbe631510768970da2230030364f7a0 diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 1646038..cf72291 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -296,7 +296,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/gdi/virdev \ vcl/source/gdi/wall \ vcl/source/gdi/scrptrun \ - vcl/source/gdi/CommonSalLayout \ + $(if $(filter-out MACOSX,$(OS)),vcl/source/gdi/CommonSalLayout) \ vcl/source/bitmap/bitmapfilter \ vcl/source/bitmap/bitmapscalesuper \ vcl/source/bitmap/BitmapScaleConvolution \ @@ -426,6 +426,7 @@ $(eval $(call gb_Library_add_defs,vcl,\ $(eval $(call gb_Library_add_objcxxflags_exception_objects,vcl,\ $(vcl_coretext_code) \ + vcl/source/gdi/CommonSalLayout \ )) $(eval $(call gb_Library_use_system_darwin_frameworks,vcl,\ diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 396991a..ceea0e8 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -371,6 +371,7 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont // get font attributes CFDictionaryRef pAttrDict = static_cast<CFDictionaryRef>(CTFontDescriptorCopyAttribute( pFD, kCTFontTraitsAttribute )); +# if MACOSX_SDK_VERSION >= 1060 if (bFontEnabled && *bFontEnabled) { // Ignore font formats not supported. @@ -384,6 +385,7 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont } CFRelease(pFormat); } +# endif // get symbolic trait // TODO: use other traits such as MonoSpace/Condensed/Expanded or Vertical too diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index fa9f411..e98baa0 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -447,6 +447,12 @@ void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) return; CTFontRef pFont = static_cast<CTFontRef>(CFDictionaryGetValue(rStyle.GetStyleDict(), kCTFontAttributeName)); +#if MACOSX_SDK_VERSION < 1070 + CGFontRef cgFont = CTFontCopyGraphicsFont( pFont, nullptr ); + CGContextSetFont( mrContext, cgFont ); + CGContextSetFontSize( mrContext, CTFontGetSize( pFont ) ); +#endif + CGAffineTransform aRotMatrix = CGAffineTransformMakeRotation(-rStyle.mfFontRotation); Point aPos; @@ -505,13 +511,22 @@ void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) CGContextSaveGState(mrContext); if (rStyle.mfFontRotation && !bUprightGlyph) CGContextRotateCTM(mrContext, rStyle.mfFontRotation); + + #if MACOSX_SDK_VERSION < 1070 + CGContextShowGlyphsAtPositions( mrContext, &aGlyphIds[ nStartIndex ], &aGlyphPos[ nStartIndex ], nLen ); + #else CTFontDrawGlyphs(pFont, &aGlyphIds[nStartIndex], &aGlyphPos[nStartIndex], nLen, mrContext); + #endif CGContextRestoreGState(mrContext); aIt = aNext; } CGContextRestoreGState(mrContext); + +#if MACOSX_SDK_VERSION < 1070 + CFRelease( cgFont ); +#endif } void AquaSalGraphics::SetFont(FontSelectPattern* pReqFont, int nFallbackLevel) commit 7c489583f757908db83c2552be004b9b1315f3bf Author: Douglas Mencken <dougmenc...@gmail.com> Date: Sat Jan 7 20:06:53 2017 -0500 external/harfbuzz: compatibility with OS X Leopard add reference to kCTTypesetterOptionForcedEmbeddingLevel kCTFontURLAttribute is not here prior to 10.6 Change-Id: Iaecaf30c97730b6dc7482766782f8faf67c00266 diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk b/external/harfbuzz/UnpackedTarball_harfbuzz.mk index 888251f..9fbd744 100644 --- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk +++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk @@ -16,6 +16,8 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0)) $(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \ external/harfbuzz/ubsan.patch \ external/harfbuzz/clang-cl.patch \ + external/harfbuzz/kCTTypesetterOptionForcedEmbeddingLevel-Leopard.patch \ + external/harfbuzz/kCTFontURLAttribute-Leopard.patch \ )) ifneq ($(ENABLE_RUNTIME_OPTIMIZATIONS),TRUE) diff --git a/external/harfbuzz/kCTFontURLAttribute-Leopard.patch b/external/harfbuzz/kCTFontURLAttribute-Leopard.patch new file mode 100644 index 0000000..7797c57 --- /dev/null +++ b/external/harfbuzz/kCTFontURLAttribute-Leopard.patch @@ -0,0 +1,45 @@ +--- src/hb-coretext.cc ++++ src/hb-coretext.cc +@@ -161,7 +161,19 @@ + return ct_font; + } + +- CFURLRef original_url = (CFURLRef)CTFontCopyAttribute(ct_font, kCTFontURLAttribute); ++ CFURLRef original_url = nullptr; ++ //original_url = (CFURLRef)CTFontCopyAttribute(ct_font, kCTFontURLAttribute); ++ /* CTFontDescriptor doesn't support kCTFontURLAttribute prior to 10.6, ++ so letâs go CTFont -> ATSFont -> FSRef -> CFURL */ ++ { ++ ATSFontRef atsFont = CTFontGetPlatformFont( ct_font, nullptr ); ++ if ( atsFont ) { ++ FSRef fsref; ++ OSStatus code = ATSFontGetFileReference( atsFont, &fsref ); ++ if ( code == noErr ) ++ original_url = CFURLCreateFromFSRef( nullptr, &fsref ); ++ } ++ } + + /* Create font copy with cascade list that has LastResort first; this speeds up CoreText + * font fallback which we don't need anyway. */ +@@ -180,7 +192,20 @@ + * system locations that we cannot access from the sandboxed renderer + * process in Blink. This can be detected by the new file URL location + * that the newly found font points to. */ +- CFURLRef new_url = (CFURLRef) CTFontCopyAttribute (new_ct_font, kCTFontURLAttribute); ++ ++ CFURLRef new_url = nullptr; ++ //new_url = (CFURLRef) CTFontCopyAttribute (new_ct_font, kCTFontURLAttribute); ++ /* CTFontDescriptor doesn't support kCTFontURLAttribute prior to 10.6 */ ++ { ++ ATSFontRef atsFont = CTFontGetPlatformFont( new_ct_font, nullptr ); ++ if ( atsFont ) { ++ FSRef fsref; ++ OSStatus code = ATSFontGetFileReference( atsFont, &fsref ); ++ if ( code == noErr ) ++ new_url = CFURLCreateFromFSRef( nullptr, &fsref ); ++ } ++ } ++ + // Keep reconfigured font if URL cannot be retrieved (seems to be the case + // on Mac OS 10.12 Sierra), speculative fix for crbug.com/625606 + if (!original_url || !new_url || CFEqual (original_url, new_url)) { diff --git a/external/harfbuzz/kCTTypesetterOptionForcedEmbeddingLevel-Leopard.patch b/external/harfbuzz/kCTTypesetterOptionForcedEmbeddingLevel-Leopard.patch new file mode 100644 index 0000000..4fffb9c --- /dev/null +++ b/external/harfbuzz/kCTTypesetterOptionForcedEmbeddingLevel-Leopard.patch @@ -0,0 +1,13 @@ +--- src/hb-coretext.cc ++++ src/hb-coretext.cc +@@ -749,6 +749,8 @@ + + int level = HB_DIRECTION_IS_FORWARD (buffer->props.direction) ? 0 : 1; + CFNumberRef level_number = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &level); ++/* Marked as available in version 10.5 and later, but not in the header until SDK 10.6 */ ++ extern const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel; + CFDictionaryRef options = CFDictionaryCreate (kCFAllocatorDefault, + (const void **) &kCTTypesetterOptionForcedEmbeddingLevel, + (const void **) &level_number, + +Diff finished. Mon Dec 15 16:56:50 2014 commit a9f772bb48bbecede51397b85b8a63a167990177 Author: Douglas Mencken <dougmenc...@gmail.com> Date: Sat Jan 7 18:25:35 2017 -0500 Revert "curl: upgrade to version 7.51.0" commit 3edb365f2651848ae8bc3b85bf0b56bd00d93270 diff --git a/download.lst b/download.lst index c28b972..225ad93 100644 --- a/download.lst +++ b/download.lst @@ -24,8 +24,8 @@ export COLLADA2GLTF_TARBALL := 4b87018f7fff1d054939d19920b751a0-collada2gltf-mas export CPPUNIT_MD5SUM := d1c6bdd5a76c66d2c38331e2d287bc01 export CPPUNIT_TARBALL := cppunit-1.13.2.tar.gz export CT2N_TARBALL := 1f467e5bb703f12cbbb09d5cf67ecf4a-converttexttonumber-1-5-0.oxt -export CURL_MD5SUM := 490e19a8ccd1f4a244b50338a0eb9456 -export CURL_TARBALL := curl-7.51.0.tar.gz +export CURL_MD5SUM := c264788f2e4313a05140d712c1ec90c2 +export CURL_TARBALL := curl-7.50.1.tar.gz export EBOOK_MD5SUM := 6b48eda57914e6343efebc9381027b78 export EBOOK_TARBALL := libe-book-0.1.2.tar.bz2 export EPOXY_MD5SUM := 96f6620a9b005a503e7b44b0b528287d diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk index eae07cf..2c3de49 100644 --- a/external/curl/ExternalProject_curl.mk +++ b/external/curl/ExternalProject_curl.mk @@ -80,7 +80,7 @@ else ifeq ($(COM),MSC) $(call gb_ExternalProject_get_state_target,curl,build): $(call gb_ExternalProject_run,build,\ - MAKEFLAGS= LIB="$(ILIB)" nmake -f Makefile.vc12 \ + MAKEFLAGS= LIB="$(ILIB)" nmake -f Makefile.vc10 \ cfg=$(if $(MSVC_USE_DEBUG_RUNTIME),debug-dll,release-dll) \ EXCFLAGS="/EHs /D_CRT_SECURE_NO_DEPRECATE /DUSE_WINDOWS_SSPI /D_USING_V110_SDK71_ $(SOLARINC)" $(if $(filter X86_64,$(CPUNAME)),MACHINE=X64) \ ,lib) diff --git a/external/curl/UnpackedTarball_curl.mk b/external/curl/UnpackedTarball_curl.mk index 536474d..f1e9209 100644 --- a/external/curl/UnpackedTarball_curl.mk +++ b/external/curl/UnpackedTarball_curl.mk @@ -14,7 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,curl,$(CURL_TARBALL),,curl)) $(eval $(call gb_UnpackedTarball_set_patchlevel,curl,1)) $(eval $(call gb_UnpackedTarball_fix_end_of_line,curl,\ - lib/Makefile.vc12 \ + lib/Makefile.vc10 \ )) $(eval $(call gb_UnpackedTarball_add_patches,curl,\ diff --git a/external/curl/curl-7.26.0_win-proxy.patch b/external/curl/curl-7.26.0_win-proxy.patch index cf41850..dff1e37 100644 --- a/external/curl/curl-7.26.0_win-proxy.patch +++ b/external/curl/curl-7.26.0_win-proxy.patch @@ -1,5 +1,5 @@ ---- curl-7.26.0/lib/Makefile.vc12 -+++ misc/build/curl-7.26.0/lib/Makefile.vc12 +--- curl-7.26.0/lib/Makefile.vc10 ++++ misc/build/curl-7.26.0/lib/Makefile.vc10 @@ -118,7 +118,7 @@ WINSSLLIBS = crypt32.lib ZLIBLIBSDLL = zdll.lib @@ -13,7 +13,7 @@ +++ misc/build/curl-7.26.0/lib/url.c @@ -78,6 +78,10 @@ bool curl_win32_idn_to_ascii(const char *in, char **out); - #endif /* USE_LIBIDN2 */ + #endif /* USE_LIBIDN */ +#ifdef _WIN32 +#include <WinHttp.h> @@ -52,7 +52,7 @@ #ifndef CURL_DISABLE_HTTP /* If proxy was not specified, we check for default proxy environment -@@ -4613,7 +4633,64 @@ +@@ -4613,7 +4633,63 @@ * For compatibility, the all-uppercase versions of these variables are * checked if the lowercase versions don't exist. */ @@ -83,10 +83,9 @@ + if(!check_noproxy(conn->host.name, no_proxy)) { + /* Look for the http proxy setting */ + char* tok; -+ char *saveptr; + + if(NULL != ieProxy) { -+ tok = strtok_s(ieProxy, ";", &saveptr); ++ tok = strtok(ieProxy, ";"); + if(strchr(tok, '=') == NULL) { + proxy = strdup(ieProxy); + } @@ -96,7 +95,7 @@ + /* We found HTTP proxy value, then use it */ + proxy = strdup(tok + 5); + } -+ tok = strtok_s(NULL, ";", &saveptr); ++ tok = strtok(NULL, ";"); + } + while(NULL != tok); + } diff --git a/external/curl/curl-msvc-schannel.patch.1 b/external/curl/curl-msvc-schannel.patch.1 index 96768aa..1091a76 100644 --- a/external/curl/curl-msvc-schannel.patch.1 +++ b/external/curl/curl-msvc-schannel.patch.1 @@ -1,7 +1,7 @@ MSVC: use WNT native Schannel SSL/TLS implementation ---- curl/lib/Makefile.vc12.old 2013-11-19 00:00:29.044499752 +0100 -+++ curl/lib/Makefile.vc12 2013-11-19 00:01:29.135499684 +0100 +--- curl/lib/Makefile.vc10.old 2013-11-19 00:00:29.044499752 +0100 ++++ curl/lib/Makefile.vc10 2013-11-19 00:01:29.135499684 +0100 @@ -260,7 +260,7 @@ TARGET = $(LIBCURL_DYN_LIB_REL) DIROBJ = $(CFG) diff --git a/external/curl/curl-msvc.patch.1 b/external/curl/curl-msvc.patch.1 index 88ced0a..927b3f1 100644 --- a/external/curl/curl-msvc.patch.1 +++ b/external/curl/curl-msvc.patch.1 @@ -1,7 +1,7 @@ MSVC: using SOLARINC and EXCFLAGS ---- curl/lib/Makefile.vc12 2012-05-24 12:07:02.000000000 -0400 -+++ curl/lib/Makefile.vc12 2012-10-29 11:53:44.658809300 -0400 +--- curl/lib/Makefile.vc10 2012-05-24 12:07:02.000000000 -0400 ++++ curl/lib/Makefile.vc10 2012-10-29 11:53:44.658809300 -0400 @@ -117,7 +117,7 @@ ZLIBLIBSDLL = zdll.lib ZLIBLIBS = zlib.lib @@ -11,14 +11,6 @@ MSVC: using SOLARINC and EXCFLAGS CFGSET = FALSE -@@ -632,7 +632,6 @@ - $(DIROBJ)\vtls.obj \ - $(DIROBJ)\openssl.obj \ - $(DIROBJ)\strdup.obj \ -- $(DIROBJ)\strequal.obj \ - $(DIROBJ)\strerror.obj \ - $(DIROBJ)\strtok.obj \ - $(DIROBJ)\strtoofft.obj \ @@ -620,11 +620,11 @@ debug-dll-ssl-dll\libcurl.res \ debug-dll-zlib-dll\libcurl.res \ commit 8ec4cbdcff1f54a321ef96e9f179ef043f39bbbe Author: Douglas Mencken <dougmenc...@gmail.com> Date: Thu Apr 14 08:56:01 2016 -0400 playing with menus & separators Change-Id: I20a51b2a173d81eb51310a04722c1b61dd49630b diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index e8963fd..142efef 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -302,6 +302,8 @@ NewMenuController::~NewMenuController() // private function void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu ) { + SAL_WARN( "framework", "fillPopupMenu()" ); + VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(VCLXMenu::GetImplementation( rPopupMenu )); PopupMenu* pVCLPopupMenu = nullptr; @@ -348,11 +350,17 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup continue; if ( aURL == "private:separator" ) + { + SAL_WARN( "framework", "separator" ); pVCLPopupMenu->InsertSeparator(); + } else { + SAL_WARN( "framework", "item ( aTitle \"" << aTitle << "\", aURL \"" << aURL << "\", nItemId " << OUString::number( nItemId ) << " )" ); + pVCLPopupMenu->InsertItem( nItemId, aTitle ); pVCLPopupMenu->SetItemCommand( nItemId, aURL ); + //pVCLPopupMenu->DoSomethingCool(); sal_uIntPtr nAttributePtr = MenuAttributes::CreateAttribute( aTargetFrame, aImageId ); pVCLPopupMenu->SetUserValue( nItemId, nAttributePtr, MenuAttributes::ReleaseAttribute ); diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index f2202d1..8d746ad 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -211,7 +211,12 @@ protected: virtual void MenuBarKeyInput(const KeyEvent& rEvent); public: - SAL_DLLPRIVATE void ImplKillLayoutData() const; + OUString& GetText() + { + return aTitleText; + } + + SAL_DLLPRIVATE void ImplBinLayoutData() const; SAL_DLLPRIVATE vcl::Window* ImplGetWindow() const { return pWindow; } #if defined(MACOSX) diff --git a/vcl/inc/osx/salmenu.h b/vcl/inc/osx/salmenu.h index f21c750..3981cdb 100644 --- a/vcl/inc/osx/salmenu.h +++ b/vcl/inc/osx/salmenu.h @@ -84,6 +84,9 @@ public: static void addFallbackMenuItem( NSMenuItem* NewItem ); static void removeFallbackMenuItem( NSMenuItem* pOldItem ); + bool IsSeparatorAt( unsigned nPos ); + static bool IsItemSeparator( AquaSalMenuItem * pAquaSalMenuItem ); + const std::vector< MenuBarButtonEntry >& getButtons() const { return maButtons; } bool mbMenuBar; // true - Menubar, false - Menu diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index e5947a4..712ff12 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -512,9 +512,36 @@ void AquaSalMenu::SetFrame( const SalFrame *pFrame ) mpFrame = static_cast<const AquaSalFrame*>(pFrame); } +bool AquaSalMenu::IsItemSeparator( AquaSalMenuItem * pAquaSalMenuItem ) +{ + if ( ! pAquaSalMenuItem ) + return false; + + return ( [ pAquaSalMenuItem->mpMenuItem isSeparatorItem ] ? true : false ); +} + +bool AquaSalMenu::IsSeparatorAt( unsigned nPos ) +{ + if( nPos < maItems.size() ) + return IsItemSeparator( maItems[ nPos ] ); + + return false; +} + void AquaSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) { - AquaSalMenuItem *pAquaSalMenuItem = static_cast<AquaSalMenuItem*>(pSalMenuItem); + AquaSalMenuItem *pAquaSalMenuItem = static_cast< AquaSalMenuItem * >( pSalMenuItem ); + NSMenuItem* nsMenuItem = pAquaSalMenuItem->mpMenuItem; + bool isSeparator = IsItemSeparator( pAquaSalMenuItem ); + +#if OSL_DEBUG_LEVEL > 0 + if ( isSeparator ) { + SAL_WARN( "vcl.osx", "AquaSalMenu::InsertItem separator at position " << nPos ); + } else { + const char* theTitle = [ [ nsMenuItem title ] UTF8String ]; + SAL_WARN( "vcl.osx", "AquaSalMenu::InsertItem with label \"" << theTitle << "\" at position " << nPos ); + } +#endif pAquaSalMenuItem->mpParentMenu = this; DBG_ASSERT( pAquaSalMenuItem->mpVCLMenu == nullptr || @@ -524,24 +551,37 @@ void AquaSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) if( pAquaSalMenuItem->mpVCLMenu ) mpVCLMenu = pAquaSalMenuItem->mpVCLMenu; - if( nPos == MENU_APPEND || nPos == maItems.size() ) - maItems.push_back( pAquaSalMenuItem ); - else if( nPos < maItems.size() ) - maItems.insert( maItems.begin() + nPos, pAquaSalMenuItem ); - else + bool bInsert = true; + if ( isSeparator ) { - OSL_FAIL( "invalid item index in insert" ); - return; + bInsert = ( nPos > 0 ) ? + ( !IsSeparatorAt( nPos ) && !IsSeparatorAt( nPos - 1 ) ) : + !IsSeparatorAt( nPos ) ; + if ( !bInsert ) + SAL_WARN( "vcl.osx", "yet another separator here is redundant" ); } - if( ! mbMenuBar || pCurrentMenuBar == this ) - [mpMenu insertItem: pAquaSalMenuItem->mpMenuItem atIndex: getItemIndexByPos(nPos)]; + if ( bInsert ) + { + if( nPos == MENU_APPEND || nPos == maItems.size() ) + maItems.push_back( pAquaSalMenuItem ); + else if( nPos < maItems.size() ) + maItems.insert( maItems.begin() + nPos, pAquaSalMenuItem ); + else + { + SAL_WARN( "vcl.osx", "position of item is somewhere out @ AquaSalMenu::InsertItem" ); + return; + } + + if( ! mbMenuBar || pCurrentMenuBar == this ) + [ mpMenu insertItem: nsMenuItem atIndex: getItemIndexByPos( nPos ) ]; + } } void AquaSalMenu::RemoveItem( unsigned nPos ) { AquaSalMenuItem* pRemoveItem = nullptr; - if( nPos == MENU_APPEND || nPos == (maItems.size()-1) ) + if( nPos == MENU_APPEND || nPos == ( maItems.size() - 1 ) ) { pRemoveItem = maItems.back(); maItems.pop_back(); @@ -549,18 +589,18 @@ void AquaSalMenu::RemoveItem( unsigned nPos ) else if( nPos < maItems.size() ) { pRemoveItem = maItems[ nPos ]; - maItems.erase( maItems.begin()+nPos ); + maItems.erase( maItems.begin() + nPos ); } else { - OSL_FAIL( "invalid item index in remove" ); + SAL_WARN( "vcl.osx", "RemoveItem: item is somewhere out" ); return; } pRemoveItem->mpParentMenu = nullptr; if( ! mbMenuBar || pCurrentMenuBar == this ) - [mpMenu removeItemAtIndex: getItemIndexByPos(nPos)]; + [ mpMenu removeItemAtIndex: getItemIndexByPos( nPos ) ]; } void AquaSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned /*nPos*/ ) @@ -801,7 +841,7 @@ void AquaSalMenu::statusLayout() if( [pNSView isMemberOfClass: [OOStatusItemView class]] ) // well of course it is [(OOStatusItemView*)pNSView layout]; else - OSL_FAIL( "someone stole our status view" ); + SAL_WARN( "vcl.osx", "¿where is my status view?" ); } } @@ -908,6 +948,8 @@ AquaSalMenuItem::AquaSalMenuItem( const SalItemParams* pItemData ) : // these can go occasionally go in and out of a menu, ensure their lifecycle // also for the release in AquaSalMenuItem destructor [mpMenuItem retain]; + + SAL_WARN( "vcl.osx", "created AquaSalMenuItem separator" ); } else { @@ -921,8 +963,16 @@ AquaSalMenuItem::AquaSalMenuItem( const SalItemParams* pItemData ) : [mpMenuItem setTitle: pString]; [pString release]; } - // anything but a separator should set a menu to dispatch to - SAL_WARN_IF( !mpVCLMenu, "vcl", "no menu" ); + +#if OSL_DEBUG_LEVEL > 0 + const char* item = [ [ mpMenuItem title ] UTF8String ]; + if ( mpVCLMenu ) { + SAL_WARN( "vcl.osx", "created AquaSalMenuItem \"" << item << "\" of menu \"" << mpVCLMenu->GetText() << "\"" ); + } else { + // anything but a separator needs a menu to dispatch to + SAL_WARN( "vcl.osx", "created AquaSalMenuItem \"" << item << "\" of *no menu*" ); + } +#endif } } diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 9e3057f..b37dc7f 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2477,6 +2477,8 @@ std::vector<OString> VclBuilder::handleItems(xmlreader::XmlReader &reader, const void VclBuilder::handleMenu(xmlreader::XmlReader &reader, const OString &rID) { + SAL_WARN( "vcl.window", "handleMenu" ); + VclPtr<PopupMenu> pCurrentMenu = VclPtr<PopupMenu>::Create(); int nLevel = 1; @@ -2522,6 +2524,8 @@ void VclBuilder::handleMenu(xmlreader::XmlReader &reader, const OString &rID) void VclBuilder::handleMenuChild(PopupMenu *pParent, xmlreader::XmlReader &reader) { + SAL_WARN( "vcl.window", "handleMenuChild" ); + xmlreader::Span name; int nsId; @@ -2719,14 +2723,17 @@ void VclBuilder::insertMenuObject(PopupMenu *pParent, const OString &rClass, con if (rClass == "GtkMenuItem") { OUString sLabel(OStringToOUString(convertMnemonicMarkup(extractLabel(rProps)), RTL_TEXTENCODING_UTF8)); + SAL_WARN( "vcl.window", "going to InsertItem with position " << nNewId << " & label \"" << sLabel << "\" & id \"" << rID << "\" @ insertMenuObject" ); pParent->InsertItem(nNewId, sLabel, MenuItemBits::TEXT, rID); } else if (rClass == "GtkSeparatorMenuItem") { + SAL_WARN( "vcl.window", "going to InsertSeparator with id \"" << rID << "\" @ insertMenuObject" ); pParent->InsertSeparator(rID); } + SAL_WARN( "vcl.window", "done insert @ insertMenuObject" ); - SAL_WARN_IF(nOldCount == pParent->GetItemCount(), "vcl.layout", "probably need to implement " << rClass.getStr()); + SAL_WARN_IF(nOldCount == pParent->GetItemCount(), "vcl", "probably need to implement " << rClass.getStr()); if (nOldCount != pParent->GetItemCount()) { @@ -2746,7 +2753,7 @@ void VclBuilder::insertMenuObject(PopupMenu *pParent, const OString &rClass, con else if (rKey == "has-default" && toBool(rValue)) pParent->SetSelectedEntry(nNewId); else - SAL_INFO("vcl.layout", "unhandled property: " << rKey.getStr()); + SAL_INFO( "vcl", "unhandled property \"" << rKey.getStr() << "\"" ); } for (stringmap::iterator aI = rAccels.begin(), aEnd = rAccels.end(); aI != aEnd; ++aI) @@ -2757,7 +2764,7 @@ void VclBuilder::insertMenuObject(PopupMenu *pParent, const OString &rClass, con if (rSignal == "activate") pParent->SetAccelKey(nNewId, makeKeyCode(rValue)); else - SAL_INFO("vcl.layout", "unhandled accelerator for: " << rSignal.getStr()); + SAL_INFO( "vcl", "unhandled accelerator for \"" << rSignal.getStr() << "\"" ); } } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 00b931e..597dc3c 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -242,7 +242,7 @@ void Menu::Deactivate() if ( ImplGetSalMenu() ) ImplGetSalMenu()->RemoveItem( n ); - pItemList->Remove( n ); + pItemList->RemoveMenuItem( n ); } } @@ -371,8 +371,8 @@ MenuItemData* Menu::NbcInsertItem(sal_uInt16 nId, MenuItemBits nBits, size_t nPos, const OString &rIdent) { // put Item in MenuItemList - MenuItemData* pData = pItemList->Insert(nId, MenuItemType::STRING, - nBits, rStr, Image(), pMenu, nPos, rIdent); + MenuItemData* pData = pItemList->InsertMenuItem( nId, MenuItemType::STRING, + nBits, rStr, Image(), pMenu, nPos, rIdent ); // update native menu if (ImplGetSalMenu() && pData->pSalMenuItem) @@ -526,6 +526,8 @@ void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference<css::f void Menu::InsertSeparator(const OString &rIdent, sal_uInt16 nPos) { + SAL_WARN( "vcl", "Menu::InsertSeparator with ident \"" << rIdent << "\" & position " << nPos ); + // do nothing if it's a menu bar if (IsMenuBar()) return; @@ -535,13 +537,13 @@ void Menu::InsertSeparator(const OString &rIdent, sal_uInt16 nPos) nPos = MENU_APPEND; // put separator in item list - pItemList->InsertSeparator(rIdent, nPos); + MenuItemData *pData = pItemList->InsertSeparator( rIdent, nPos ); // update native menu - size_t itemPos = ( nPos != MENU_APPEND ) ? nPos : pItemList->size() - 1; - MenuItemData *pData = pItemList->GetDataFromPos( itemPos ); if( ImplGetSalMenu() && pData && pData->pSalMenuItem ) + { ImplGetSalMenu()->InsertItem( pData->pSalMenuItem, nPos ); + } delete mpLayoutData; mpLayoutData = nullptr; @@ -559,7 +561,7 @@ void Menu::RemoveItem( sal_uInt16 nPos ) if( ImplGetSalMenu() ) ImplGetSalMenu()->RemoveItem( nPos ); - pItemList->Remove( nPos ); + pItemList->RemoveMenuItem( nPos ); bRemove = true; } @@ -1404,7 +1406,7 @@ bool Menu::ImplGetNativeSubmenuArrowSize(vcl::RenderContext& rRenderContext, Siz void Menu::ImplAddDel( ImplMenuDelData& rDel ) { - SAL_WARN_IF( rDel.mpMenu, "vcl", "Menu::ImplAddDel(): cannot add ImplMenuDelData twice !" ); + SAL_WARN_IF( rDel.mpMenu, "vcl", "Menu::ImplAddDel(): cannot add ImplMenuDelData twice" ); if( !rDel.mpMenu ) { rDel.mpMenu = this; @@ -2245,7 +2247,7 @@ void Menu::MenuBarKeyInput(const KeyEvent&) { } -void Menu::ImplKillLayoutData() const +void Menu::ImplBinLayoutData() const { delete mpLayoutData; mpLayoutData = nullptr; diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index f922901..a70205d 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -984,7 +984,7 @@ void MenuBarWindow::StateChanged( StateChangedType nType ) } else if(pMenu) { - pMenu->ImplKillLayoutData(); + pMenu->ImplBinLayoutData(); } } @@ -1010,7 +1010,7 @@ void MenuBarWindow::LayoutChanged() Invalidate(); Resize(); - pMenu->ImplKillLayoutData(); + pMenu->ImplBinLayoutData(); } void MenuBarWindow::ApplySettings(vcl::RenderContext& rRenderContext) diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 79586c0..5b8493b 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -599,7 +599,7 @@ void MenuFloatingWindow::ImplScroll( bool bUp ) Invalidate(); - pMenu->ImplKillLayoutData(); + pMenu->ImplBinLayoutData(); if ( bScrollUp && bUp ) { diff --git a/vcl/source/window/menuitemlist.cxx b/vcl/source/window/menuitemlist.cxx index 44757a4..27eb2eb 100644 --- a/vcl/source/window/menuitemlist.cxx +++ b/vcl/source/window/menuitemlist.cxx @@ -50,7 +50,7 @@ MenuItemList::~MenuItemList() delete i; } -MenuItemData* MenuItemList::Insert( +MenuItemData* MenuItemList::InsertMenuItem( sal_uInt16 nId, MenuItemType eType, MenuItemBits nBits, @@ -61,6 +61,12 @@ MenuItemData* MenuItemList::Insert( const OString &rIdent ) { + SAL_WARN( "vcl", "MenuItemList::InsertMenuItem with ident \"" << rIdent << "\" & id " << nId + << " & text \"" << rStr << "\" & position " << nPos ); + + if ( eType == MenuItemType::SEPARATOR ) + return InsertSeparator( rIdent, nPos ); + MenuItemData* pData = new MenuItemData( rStr, rImage ); pData->nId = nId; pData->sIdent = rIdent; @@ -90,11 +96,14 @@ MenuItemData* MenuItemList::Insert( } else { maItemList.push_back( pData ); } + return pData; } -void MenuItemList::InsertSeparator(const OString &rIdent, size_t nPos) +MenuItemData* MenuItemList::InsertSeparator( const OString &rIdent, size_t nPos ) { + SAL_WARN( "vcl", "MenuItemList::InsertSeparator with ident \"" << rIdent << "\" & position " << nPos ); + MenuItemData* pData = new MenuItemData; pData->nId = 0; pData->sIdent = rIdent; @@ -116,23 +125,94 @@ void MenuItemList::InsertSeparator(const OString &rIdent, size_t nPos) aSalMIData.aText.clear(); aSalMIData.aImage = Image(); - // Native-support: returns NULL if not supported + // create native item returns nil if it is not supported pData->pSalMenuItem = ImplGetSVData()->mpDefInst->CreateMenuItem( &aSalMIData ); if( nPos < maItemList.size() ) { - maItemList.insert( maItemList.begin() + nPos, pData ); + if ( maItemList[ nPos ] && maItemList[ nPos ]->eType != MenuItemType::SEPARATOR ) + { + if ( nPos > 0 && maItemList[ nPos - 1 ] && maItemList[ nPos - 1 ]->eType != MenuItemType::SEPARATOR ) + { + maItemList.insert( maItemList.begin() + nPos, pData ); + } + else { SAL_WARN( "vcl", "separator is just above" ); } + } + else { SAL_WARN( "vcl", "separator is already here" ); } } else { - maItemList.push_back( pData ); + if ( maItemList.back() && maItemList.back()->eType != MenuItemType::SEPARATOR ) + { + maItemList.push_back( pData ); + } } + + return pData; } -void MenuItemList::Remove( size_t nPos ) +void MenuItemList::RemoveMenuItem( size_t nPos ) { if( nPos < maItemList.size() ) { delete maItemList[ nPos ]; maItemList.erase( maItemList.begin() + nPos ); } + + PeelSeparators(); +} + +// bin double separators and boundary ones +bool MenuItemList::PeelSeparators( bool bLastOneToo ) +{ + SAL_WARN( "vcl", "MenuItemList::PeelSeparators" ); + + bool bRet = false; + + for ( size_t i = 1; i < maItemList.size(); ++i ) + { + if ( ( maItemList[ i ] && maItemList[ i ]->eType == MenuItemType::SEPARATOR ) + && ( maItemList[ i - 1 ] && maItemList[ i - 1 ]->eType == MenuItemType::SEPARATOR ) ) { + SAL_WARN( "vcl.window", "double separators @" << OUString::number( i ) << " & @" << OUString::number( i - 1 ) ); + delete maItemList[ i ]; + maItemList.erase( maItemList.begin() + i ); + i--; + bRet = true; + } + } + + while ( maItemList.size() > 0 ) + { + if ( maItemList[ 0 ] && maItemList[ 0 ]->eType == MenuItemType::SEPARATOR ) + { + SAL_WARN( "vcl.window", "first item @" << OUString::number( 0 ) + << " \"" << maItemList[ 0 ]->aText + << "\" id " << OUString::number( maItemList[ 0 ]->nId ) + << " is separator" ); + delete maItemList[ 0 ]; + maItemList.erase( maItemList.begin() ); + bRet = true; + } + else { break; } + } + + if ( bLastOneToo ) + { + while ( maItemList.size() > 0 ) + { + if ( maItemList[ maItemList.size() - 1 ]->eType == MenuItemType::SEPARATOR ) + { + size_t n = maItemList.size() - 1; + SAL_WARN( "vcl.window", "last item @" << OUString::number( n ) + << " \"" << maItemList[ n ]->aText + << "\" id " << OUString::number( maItemList[ n ]->nId ) + << " is separator" ); + delete maItemList[ n ]; + maItemList.erase( maItemList.end() ); + bRet = true; + } + else { break; } + } + } + + return bRet; } MenuItemData* MenuItemList::GetData( sal_uInt16 nSVId, size_t& rPos ) const diff --git a/vcl/source/window/menuitemlist.hxx b/vcl/source/window/menuitemlist.hxx index 89befc1..a2eedb9 100644 --- a/vcl/source/window/menuitemlist.hxx +++ b/vcl/source/window/menuitemlist.hxx @@ -97,14 +97,13 @@ struct MenuItemData class MenuItemList { private: - typedef ::std::vector< MenuItemData* > MenuItemDataList_impl; - MenuItemDataList_impl maItemList; + ::std::vector< MenuItemData* > maItemList; public: MenuItemList() {} ~MenuItemList(); - MenuItemData* Insert( + MenuItemData* InsertMenuItem( sal_uInt16 nId, MenuItemType eType, MenuItemBits nBits, @@ -114,8 +113,9 @@ public: size_t nPos, const OString &rIdent ); - void InsertSeparator(const OString &rIdent, size_t nPos); - void Remove( size_t nPos ); + MenuItemData* InsertSeparator(const OString &rIdent, size_t nPos); + void RemoveMenuItem( size_t nPos ); + bool PeelSeparators( bool bLastOneToo = false ); MenuItemData* GetData( sal_uInt16 nSVId, size_t& rPos ) const; MenuItemData* GetData( sal_uInt16 nSVId ) const commit 334b5167cf091cb85211dcd2f596058c927b9e6e Author: Douglas Mencken <dougmenc...@gmail.com> Date: Fri Oct 7 14:03:18 2016 -0400 Let that â abletorunwindowsnativelysowhytouseOS â rest in peace This reverts commit a6c88e4bf1d148ac462c2bcd7061eff602b627d6 SAL_WNODEPRECATED_DECLARATIONS_ around new 10.12 deprecations diff --git a/apple_remote/source/RemoteMainController.m b/apple_remote/source/RemoteMainController.m index 9e933a3..79af22f 100644 --- a/apple_remote/source/RemoteMainController.m +++ b/apple_remote/source/RemoteMainController.m @@ -85,8 +85,6 @@ - (void) postTheEvent: (short int)buttonIdentifier modifierFlags:(int)modifierFlags { -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12 [NSApp postEvent: [NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint @@ -98,7 +96,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH data1: buttonIdentifier data2: 0] atStart: NO]; -SAL_WNODEPRECATED_DECLARATIONS_POP } diff --git a/vcl/osx/DropTarget.cxx b/vcl/osx/DropTarget.cxx index 90abe7a..5fb8a72 100644 --- a/vcl/osx/DropTarget.cxx +++ b/vcl/osx/DropTarget.cxx @@ -388,12 +388,7 @@ void SAL_CALL DropTarget::initialize(const Sequence< Any >& aArguments) id wnd = [mView window]; NSWindow* parentWnd = [wnd parentWindow]; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSClosableWindowMask' is deprecated: first deprecated in macOS 10.12 - // 'NSResizableWindowMask' is deprecated: first deprecated in macOS 10.12 - // 'NSTitleWindowMask' is deprecated: first deprecated in macOS 10.12 unsigned int topWndStyle = (NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask); -SAL_WNODEPRECATED_DECLARATIONS_POP unsigned int wndStyles = [wnd styleMask] & topWndStyle; if (parentWnd == nil && (wndStyles == topWndStyle)) diff --git a/vcl/osx/a11ytextattributeswrapper.mm b/vcl/osx/a11ytextattributeswrapper.mm index 7374a86..042fafd 100644 --- a/vcl/osx/a11ytextattributeswrapper.mm +++ b/vcl/osx/a11ytextattributeswrapper.mm @@ -272,11 +272,6 @@ using namespace ::com::sun::star::uno; sal_Int32 alignment; property.Value >>= alignment; NSNumber *textAlignment = nil; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSCenterTextAlignment' is deprecated: first deprecated in macOS 10.12 - // 'NSJustifiedTextAlignment' is deprecated: first deprecated in macOS 10.12 - // 'NSLeftTextAlignment' is deprecated: first deprecated in macOS 10.12 - // 'NSRightTextAlignment' is deprecated: first deprecated in macOS 10.12 switch(alignment) { case css::style::ParagraphAdjust_RIGHT : textAlignment = [NSNumber numberWithInteger:NSRightTextAlignment] ; break; case css::style::ParagraphAdjust_CENTER: textAlignment = [NSNumber numberWithInteger:NSCenterTextAlignment] ; break; @@ -284,7 +279,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH case css::style::ParagraphAdjust_LEFT : default : textAlignment = [NSNumber numberWithInteger:NSLeftTextAlignment] ; break; } -SAL_WNODEPRECATED_DECLARATIONS_POP NSDictionary *paragraphStyle = [NSDictionary dictionaryWithObjectsAndKeys:textAlignment, @"AXTextAlignment", textAlignment, @"AXVisualTextAlignment", nil]; [string addAttribute:@"AXParagraphStyle" value:paragraphStyle range:range]; } diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index f082a416..6800e4b 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -156,12 +156,6 @@ void AquaSalFrame::initWindowAndView() maGeometry.nHeight = static_cast<unsigned int>(aVisibleRect.size.height * 0.8); // calculate style mask -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSBorderlessWindowMask' is deprecated: first deprecated in macOS 10.12 - // 'NSClosableWindowMask' is deprecated: first deprecated in macOS 10.12 - // 'NSMiniaturizableWindowMask' is deprecated: first deprecated in macOS 10.12 - // 'NSResizableWindowMask' is deprecated: first deprecated in macOS 10.12 - // 'NSTitledWindowMask' is deprecated: first deprecated in macOS 10.12 if( (mnStyle & SalFrameStyleFlags::FLOAT) || (mnStyle & SalFrameStyleFlags::OWNERDRAWDECORATION) ) mnStyleMask = NSBorderlessWindowMask; @@ -195,7 +189,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH if( mnStyleMask != 0 ) mnStyleMask |= NSTitledWindowMask; } -SAL_WNODEPRECATED_DECLARATIONS_POP // #i91990# support GUI-less (daemon) execution @try @@ -1413,17 +1406,6 @@ SalPointerState AquaSalFrame::GetPointerState() if( pCur ) { bMouseEvent = true; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSLeftMouseDown' is deprecated: first deprecated in macOS 10.12 - // 'NSLeftMouseDragged' is deprecated: first deprecated in macOS 10.12 - // 'NSLeftMouseUp' is deprecated: first deprecated in macOS 10.12 - // 'NSMouseMoved' is deprecated: first deprecated in macOS 10.12 - // 'NSOtherMouseDown' is deprecated: first deprecated in macOS 10.12 - // 'NSOtherMouseDragged' is deprecated: first deprecated in macOS 10.12 - // 'NSOtherMouseUp' is deprecated: first deprecated in macOS 10.12 - // 'NSRightMouseDown' is deprecated: first deprecated in macOS 10.12 - // 'NSRightMouseDragged' is deprecated: first deprecated in macOS 10.12 - // 'NSRightMouseUp' is deprecated: first deprecated in macOS 10.12 switch( [pCur type] ) { case NSLeftMouseDown: state.mnState |= MOUSE_LEFT; break; @@ -1441,16 +1423,10 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH bMouseEvent = false; break; } -SAL_WNODEPRECATED_DECLARATIONS_POP } if( bMouseEvent ) { unsigned int nMask = (unsigned int)[pCur modifierFlags]; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 if( (nMask & NSShiftKeyMask) != 0 ) state.mnState |= KEY_SHIFT; if( (nMask & NSControlKeyMask) != 0 ) @@ -1459,7 +1435,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH state.mnState |= KEY_MOD2; if( (nMask & NSCommandKeyMask) != 0 ) state.mnState |= KEY_MOD1; -SAL_WNODEPRECATED_DECLARATIONS_POP } else diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index 060a7d5..f779570 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -46,11 +46,6 @@ static sal_uInt16 ImplGetModifierMask( unsigned int nMask ) { sal_uInt16 nRet = 0; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 if( (nMask & NSShiftKeyMask) != 0 ) nRet |= KEY_SHIFT; if( (nMask & NSControlKeyMask) != 0 ) @@ -59,7 +54,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH nRet |= KEY_MOD2; if( (nMask & NSCommandKeyMask) != 0 ) nRet |= KEY_MOD1; -SAL_WNODEPRECATED_DECLARATIONS_POP return nRet; } @@ -166,14 +160,8 @@ static const struct ExceptionalKey const unsigned int nModifierMask; } aExceptionalKeys[] = { -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 { KEY_D, NSControlKeyMask | NSShiftKeyMask | NSAlternateKeyMask }, { KEY_D, NSCommandKeyMask | NSShiftKeyMask | NSAlternateKeyMask } -SAL_WNODEPRECATED_DECLARATIONS_POP }; static AquaSalFrame* getMouseContainerFrame() @@ -868,10 +856,7 @@ private: { dX += [pEvent deltaX]; dY += [pEvent deltaY]; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSScrollWheelMask' is deprecated: first deprecated in macOS 10.12 NSEvent* pNextEvent = [NSApp nextEventMatchingMask: NSScrollWheelMask -SAL_WNODEPRECATED_DECLARATIONS_POP untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES ]; if( !pNextEvent ) break; @@ -931,10 +916,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP { dX += [pEvent deltaX]; dY += [pEvent deltaY]; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSScrollWheelMask' is deprecated: first deprecated in macOS 10.12 NSEvent* pNextEvent = [NSApp nextEventMatchingMask: NSScrollWheelMask -SAL_WNODEPRECATED_DECLARATIONS_POP untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES ]; if( !pNextEvent ) break; @@ -1020,12 +1002,8 @@ SAL_WNODEPRECATED_DECLARATIONS_POP interpretKeyEvents (why?). Try to dispatch them here first, if not successful continue normally */ -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 if( (mpFrame->mnLastModifierFlags & (NSAlternateKeyMask | NSCommandKeyMask)) == (NSAlternateKeyMask | NSCommandKeyMask) ) -SAL_WNODEPRECATED_DECLARATIONS_POP { if( [self sendSingleCharacter: mpLastEvent] ) return YES; @@ -1101,12 +1079,6 @@ SAL_WNODEPRECATED_DECLARATIONS_POP // #i99567# // find out the unmodified key code -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSKeyDown' is deprecated: first deprecated in macOS 10.12 - // 'NSKeyUp' is deprecated: first deprecated in macOS 10.12 // sanity check if( mpLastEvent && ( [mpLastEvent type] == NSKeyDown || [mpLastEvent type] == NSKeyUp ) ) { @@ -1130,7 +1102,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH { nLastModifiers = 0; } -SAL_WNODEPRECATED_DECLARATIONS_POP [self sendKeyInputAndReleaseToFrame: nKeyCode character: aCharCode modifiers: nLastModifiers]; } else @@ -1183,10 +1154,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP -(void)moveLeftAndModifySelection: (id)aSender { (void)aSender; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 [self sendKeyInputAndReleaseToFrame: KEY_LEFT character: 0 modifiers: NSShiftKeyMask]; -SAL_WNODEPRECATED_DECLARATIONS_POP } -(void)moveBackwardAndModifySelection: (id)aSender @@ -1204,10 +1172,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP -(void)moveRightAndModifySelection: (id)aSender { (void)aSender; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 [self sendKeyInputAndReleaseToFrame: KEY_RIGHT character: 0 modifiers: NSShiftKeyMask]; -SAL_WNODEPRECATED_DECLARATIONS_POP } -(void)moveForwardAndModifySelection: (id)aSender diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx index d46591f..34830a8 100644 --- a/vcl/osx/salinst.cxx +++ b/vcl/osx/salinst.cxx @@ -373,8 +373,6 @@ void AquaSalInstance::wakeupYield() if( mbWaitingYield ) { SalData::ensureThreadAutoreleasePool(); -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12 NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined location: NSZeroPoint modifierFlags: 0 @@ -384,7 +382,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH subtype: AquaSalInstance::YieldWakeupEvent data1: 0 data2: 0 ]; -SAL_WNODEPRECATED_DECLARATIONS_POP if( pEvent ) [NSApp postEvent: pEvent atStart: NO]; } @@ -623,10 +620,7 @@ SalYieldResult AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents { sal_uLong nCount = ReleaseYieldMutex(); -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSAnyEventMask' is deprecated: first deprecated in macOS 10.12 pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: nil -SAL_WNODEPRECATED_DECLARATIONS_POP inMode: NSDefaultRunLoopMode dequeue: YES]; if( pEvent ) { @@ -644,10 +638,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP sal_uLong nCount = ReleaseYieldMutex(); NSDate* pDt = AquaSalTimer::pRunningTimer ? [AquaSalTimer::pRunningTimer fireDate] : [NSDate distantFuture]; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSAnyEventMask' is deprecated: first deprecated in macOS 10.12 pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: pDt -SAL_WNODEPRECATED_DECLARATIONS_POP inMode: NSDefaultRunLoopMode dequeue: YES]; if( pEvent ) [NSApp sendEvent: pEvent]; @@ -749,23 +740,6 @@ bool AquaSalInstance::AnyInput( VclInputFlags nType ) return false; unsigned/*NSUInteger*/ nEventMask = 0; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSFlagsChangedMask' is deprecated: first deprecated in macOS 10.12 - // 'NSKeyDownMask' is deprecated: first deprecated in macOS 10.12 - // 'NSKeyUpMask' is deprecated: first deprecated in macOS 10.12 - // 'NSLeftMouseDownMask' is deprecated: first deprecated in macOS 10.12 - // 'NSLeftMouseDraggedMask' is deprecated: first deprecated in macOS 10.12 - // 'NSLeftMouseUpMask' is deprecated: first deprecated in macOS 10.12 - // 'NSMouseEnteredMask' is deprecated: first deprecated in macOS 10.12 - // 'NSMouseExitedMask' is deprecated: first deprecated in macOS 10.12 - // 'NSOtherMouseDownMask' is deprecated: first deprecated in macOS 10.12 - // 'NSOtherMouseDraggedMask' is deprecated: first deprecated in macOS 10.12 - // 'NSOtherMouseUpMask' is deprecated: first deprecated in macOS 10.12 - // 'NSRightMouseDownMask' is deprecated: first deprecated in macOS 10.12 - // 'NSRightMouseDraggedMask' is deprecated: first deprecated in macOS 10.12 - // 'NSRightMouseUpMask' is deprecated: first deprecated in macOS 10.12 - // 'NSScrollWheelMask' is deprecated: first deprecated in macOS 10.12 - // 'NSTabletPoint' is deprecated: first deprecated in macOS 10.12 if( nType & VclInputFlags::MOUSE) nEventMask |= NSLeftMouseDownMask | NSRightMouseDownMask | NSOtherMouseDownMask | @@ -778,7 +752,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH nEventMask |= NSKeyDownMask | NSKeyUpMask | NSFlagsChangedMask; if( nType & VclInputFlags::OTHER) nEventMask |= NSTabletPoint; -SAL_WNODEPRECATED_DECLARATIONS_POP // TODO: VclInputFlags::PAINT / more VclInputFlags::OTHER if( !bool(nType) ) return false; diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index a7b90a0..e5947a4 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -157,10 +157,7 @@ static void initAppMenu() [pString release]; if( pNewItem ) { -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 [pNewItem setKeyEquivalentModifierMask: NSCommandKeyMask]; -SAL_WNODEPRECATED_DECLARATIONS_POP [pNewItem setTarget: pMainMenuSelector]; [pAppMenu insertItem: [NSMenuItem separatorItem] atIndex: 3]; } @@ -758,11 +755,6 @@ void AquaSalMenu::SetAccelerator( unsigned /*nPos*/, SalMenuItem* pSalMenuItem, // should always use the command key int nItemModifier = 0; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 if (nModifier & KEY_SHIFT) { nItemModifier |= NSShiftKeyMask; // actually useful only for function keys @@ -778,7 +770,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH if(nModifier & KEY_MOD3) nItemModifier |= NSControlKeyMask; -SAL_WNODEPRECATED_DECLARATIONS_POP AquaSalMenuItem *pAquaSalMenuItem = static_cast<AquaSalMenuItem *>(pSalMenuItem); NSString* pString = CreateNSString( OUString( &nCommandKey, 1 ) ); diff --git a/vcl/osx/salnsmenu.mm b/vcl/osx/salnsmenu.mm index f777a44..be772f9 100644 --- a/vcl/osx/salnsmenu.mm +++ b/vcl/osx/salnsmenu.mm @@ -99,12 +99,6 @@ // must still end up in the view. This is necessary to handle common edit actions in docked // windows (e.g. in toolbar fields). NSEvent* pEvent = [NSApp currentEvent]; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSKeyDown' is deprecated: first deprecated in macOS 10.12 - // 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 if( pEvent && [pEvent type] == NSKeyDown ) { unsigned int nModMask = ([pEvent modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)); @@ -120,7 +114,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH return; } } -SAL_WNODEPRECATED_DECLARATIONS_POP const AquaSalFrame* pFrame = mpMenuItem->mpParentMenu ? mpMenuItem->mpParentMenu->getFrame() : nullptr; if( pFrame && AquaSalFrame::isAlive( pFrame ) && ! pFrame->GetWindow()->IsInModalMode() ) @@ -180,10 +173,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP aImgRect.origin.y = floor((aFrame.size.height - aFromRect.size.height)/2); aImgRect.size = aFromRect.size; if( rButtons[i].mpNSImage ) -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSCompositeSourceOver' is deprecated: first deprecated in macOS 10.12 [rButtons[i].mpNSImage drawInRect: aImgRect fromRect: aFromRect operation: NSCompositeSourceOver fraction: 1.0]; -SAL_WNODEPRECATED_DECLARATIONS_POP aImgRect.origin.x += aFromRect.size.width + 2; } } diff --git a/vcl/osx/saltimer.cxx b/vcl/osx/saltimer.cxx index 2a31581..5a242e8 100644 --- a/vcl/osx/saltimer.cxx +++ b/vcl/osx/saltimer.cxx @@ -68,8 +68,6 @@ void ImplSalStartTimer( sal_uLong nMS ) { SalData::ensureThreadAutoreleasePool(); // post an event so we can get into the main thread -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12 NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined location: NSZeroPoint modifierFlags: 0 @@ -79,7 +77,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH subtype: AquaSalInstance::AppStartTimerEvent data1: (int)nMS data2: 0 ]; -SAL_WNODEPRECATED_DECLARATIONS_POP if( pEvent ) [NSApp postEvent: pEvent atStart: YES]; } diff --git a/vcl/osx/vclnsapp.mm b/vcl/osx/vclnsapp.mm index 4c38466..43fc01e 100644 --- a/vcl/osx/vclnsapp.mm +++ b/vcl/osx/vclnsapp.mm @@ -61,8 +61,6 @@ { (void)pNotification; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12 NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined location: NSZeroPoint modifierFlags: 0 @@ -72,7 +70,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH subtype: AquaSalInstance::AppExecuteSVMain data1: 0 data2: 0 ]; -SAL_WNODEPRECATED_DECLARATIONS_POP if( pEvent ) [NSApp postEvent: pEvent atStart: NO]; } @@ -80,15 +77,6 @@ SAL_WNODEPRECATED_DECLARATIONS_POP -(void)sendEvent:(NSEvent*)pEvent { NSEventType eType = [pEvent type]; -SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12 - // 'NSClosableWindowMask' is deprecated: first deprecated in macOS 10.12 - // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12 - // 'NSKeyDown' is deprecated: first deprecated in macOS 10.12 - // 'NSMiniaturizableWindowMask' is deprecated: first deprecated in macOS 10.12 - // 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12 if( eType == NSApplicationDefined ) { AquaSalInstance::handleAppDefinedEvent( pEvent ); @@ -236,7 +224,6 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH } } } -SAL_WNODEPRECATED_DECLARATIONS_POP [super sendEvent: pEvent]; } commit 558d8eddfa4ff62f5675809dc46d52fd8c7a84c3 Author: Douglas Mencken <dougmenc...@gmail.com> Date: Sun Sep 25 09:15:34 2016 -0400 Tweaks for instsetoo_native/CustomTarget_setup.mk when â ' â is used in some variable, this script fails e.g syntax error near unexpected token `(' /bin/sh: -c: line 9: `&& echo 'UpdateUserAgent=<PRODUCT> (${buildid}; ${_OS}; ${_ARCH}; <OPTIONAL_OS_HW_DATA>)' \' /bin/sh: -c: line 10: unexpected EOF while looking for matching `'' /bin/sh: -c: line 12: syntax error: unexpected end of file Change-Id: Id68558533b14e81bd4c4a3f72e7946d9c6ffc5bd diff --git a/instsetoo_native/CustomTarget_setup.mk b/instsetoo_native/CustomTarget_setup.mk index c8b9757..f186c48 100644 --- a/instsetoo_native/CustomTarget_setup.mk +++ b/instsetoo_native/CustomTarget_setup.mk @@ -150,16 +150,16 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,version) : $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1) ( \ - echo '[Version]' \ - && echo 'AllLanguages=$(if $(gb_WITH_LANG),$(gb_WITH_LANG),en-US)' \ - && echo 'BuildVersion=$(BUILD_VER_STRING)' \ - && echo 'buildid=$(shell cd $(SRCDIR) && git log -1 --format=%H)' \ - && echo 'ExtensionUpdateURL=http://updateexte.libreoffice.org/ExtensionUpdateService/check.Update' \ - && echo 'ReferenceOOoMajorMinor=4.1' \ - && echo 'UpdateID=$(PRODUCTNAME)_$(LIBO_VERSION_MAJOR)_en-US' \ - && echo 'UpdateURL=$(if $(ENABLE_ONLINE_UPDATE),http://update.libreoffice.org/check.php$(if $(filter-out WNT,$(OS)),?pkgfmt=$(PKGFORMAT)))' \ - && echo 'UpdateUserAgent=<PRODUCT> ($${buildid}; $${_OS}; $${_ARCH}; <OPTIONAL_OS_HW_DATA>)' \ - && echo 'Vendor=$(OOO_VENDOR)' \ + echo "[Version]" \ + && echo "AllLanguages=$(if $(gb_WITH_LANG),$(gb_WITH_LANG),en-US)" \ + && echo "BuildVersion=$(BUILD_VER_STRING)" \ + && echo "buildid=$(shell cd $(SRCDIR) && git log -1 --format=%H)" \ + && echo "ExtensionUpdateURL=http://updateexte.libreoffice.org/ExtensionUpdateService/check.Update" \ + && echo "ReferenceOOoMajorMinor=4.1" \ + && echo "UpdateID=$(PRODUCTNAME)_$(LIBO_VERSION_MAJOR)_en-US" \ + && echo "UpdateURL=$(if $(ENABLE_ONLINE_UPDATE),http://update.libreoffice.org/check.php$(if $(filter-out WNT,$(OS)),?pkgfmt=$(PKGFORMAT)))" \ + && echo "UpdateUserAgent=LibreOffice for Mac OS X PowerPC <OPTIONAL_OS_HW_DATA>" \ + && echo "Vendor=$(OOO_VENDOR)" \ ) > $@ # vim: set noet sw=4 ts=4: commit f479bdc499e4bd98e7938c19665770ecb47cd63b Author: Douglas Mencken <dougmenc...@gmail.com> Date: Sun Sep 18 16:49:21 2016 -0400 trying to figure out whatâs wrong with gengal and paths diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index 69a380e..c593e1b 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -193,11 +193,17 @@ Gallery* Gallery::GetGalleryInstance() void Gallery::ImplLoad( const OUString& rMultiPath ) { +OString blah = OUStringToOString( rMultiPath, RTL_TEXTENCODING_UTF8 ); +fprintf( stderr, "void Gallery::ImplLoad( \"%s\" )\n", blah.pData->buffer ); + const sal_Int32 nTokenCount = comphelper::string::getTokenCount(rMultiPath, ';'); bool bIsReadOnlyDir; bMultiPath = ( nTokenCount > 0 ); +OString configpath = OUStringToOString( SvtPathOptions().GetConfigPath(), RTL_TEXTENCODING_UTF8 ); +fprintf( stderr, "void Gallery::ImplLoad SvtPathOptions().GetConfigPath() is \"%s\"\n", configpath.pData->buffer ); + INetURLObject aCurURL(SvtPathOptions().GetConfigPath()); ImplLoadSubDirs( aCurURL, bIsReadOnlyDir ); @@ -227,6 +233,8 @@ void Gallery::ImplLoad( const OUString& rMultiPath ) void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, bool& rbDirIsReadOnly ) { +fprintf( stderr, "void Gallery::ImplLoadSubDirs\n" ); + rbDirIsReadOnly = false; try diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx index 4541118..e29af99 100644 --- a/svx/source/gengal/gengal.cxx +++ b/svx/source/gengal/gengal.cxx @@ -61,6 +61,9 @@ protected: Gallery* createGallery( const OUString& rURL ) { +OString blah = OUStringToOString( rURL, RTL_TEXTENCODING_UTF8 ); +fprintf( stderr, "gengal createGallery( \"%s\" )\n", blah.pData->buffer ); + return new Gallery( rURL ); } @@ -73,9 +76,9 @@ static void createTheme( const OUString& aThemeName, const OUString& aGalleryURL const OUString& aDestDir, std::vector<INetURLObject> &rFiles, bool bRelativeURLs ) { - Gallery* pGallery; +fprintf( stderr, "gengal top of static void createTheme\n" ); - pGallery = createGallery( aGalleryURL ); + Gallery* pGallery = createGallery( aGalleryURL ); if (!pGallery ) { fprintf( stderr, "Could't create '%s'\n", OUStringToOString( aGalleryURL, RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -170,9 +173,10 @@ static INetURLObject Smartify( const OUString &rPath ) void GalApp::Init() { - try { if( !mbInBuildTree && getenv( "OOO_INSTALL_PREFIX" ) == nullptr ) { OUString fileName = GetAppFileName(); +OString blah = OUStringToOString( fileName, RTL_TEXTENCODING_UTF8 ); +fprintf( stderr, "gengal GalApp::Init() fileName is \"%s\"\n", blah.pData->buffer ); int lastSlash = fileName.lastIndexOf( '/' ); #ifdef _WIN32 // Don't know which directory separators GetAppFileName() returns on Windows. @@ -180,32 +184,30 @@ void GalApp::Init() if( fileName.lastIndexOf( '\\' ) > lastSlash ) lastSlash = fileName.lastIndexOf( '\\' ); #endif - OUString baseBinDir = fileName.copy( 0, lastSlash ); - OUString installPrefix = baseBinDir + "/../.."; + OUString path = fileName.copy( 0, lastSlash ); + OUString installPrefix = path + "/../.."; - OUString envVar( "OOO_INSTALL_PREFIX"); - osl_setEnvironment(envVar.pData, installPrefix.pData); + OUString envVar( "OOO_INSTALL_PREFIX" ); + osl_setEnvironment( envVar.pData, installPrefix.pData ); } SAL_INFO("svx", "OOO_INSTALL_PREFIX=" << getenv( "OOO_INSTALL_PREFIX" ) ); - uno::Reference<uno::XComponentContext> xComponentContext - = ::cppu::defaultBootstrap_InitialComponentContext(); - xMSF.set( xComponentContext->getServiceManager(), uno::UNO_QUERY ); - if( !xMSF.is() ) + uno::Reference<uno::XComponentContext> xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext(); + bool okay = true; + if ( ! xComponentContext.is() ) + okay = false; + else + { + xMSF.set( xComponentContext->getServiceManager(), uno::UNO_QUERY ); + if( !xMSF.is() ) okay = false; + } + if ( ! okay ) { - fprintf( stderr, "Failed to bootstrap\n" ); + fprintf( stderr, "GalApp::Init can not bootstrap\n" ); exit( 1 ); } - ::comphelper::setProcessServiceFactory( xMSF ); - // For backwards compatibility, in case some code still uses plain - // createInstance w/o args directly to obtain an instance: - css::ucb::UniversalContentBroker::create(xComponentContext); - } catch (const uno::Exception &e) { - fprintf( stderr, "Bootstrap exception '%s'\n", - rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - exit( 1 ); - } + ::comphelper::setProcessServiceFactory( xMSF ); } std::vector<OUString> ReadResponseFile_Impl(OUString const& rInput) @@ -275,6 +277,8 @@ ReadResponseFile(std::vector<INetURLObject> & rFiles, OUString const& rInput) int GalApp::Main() { +fprintf( stderr, "hola from gengal GalApp::Main()\n" ); + try { ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits